Don't crash when deleted during network operations
ClosedPublic

Authored by leinir on Jun 13 2017, 12:52 PM.

Details

Summary

Without this patch, we occasionally end up in a situation where the DesktopIcon object is deleted while we are still fetching data from the network, resulting in attempting to access member variables which have since been deleted.

Test Plan

This can be provoked in Discover by scrolling through a long list of KNS items (such as the Plasma -> Wallpapers section) using the scrollbar. Simply scroll up and down rapidly, and a crash will occur with high regularity (within a matter of a second or two). With this patch, the crash is entirely eliminated.

Diff Detail

Repository
R169 Kirigami
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
leinir created this revision.Jun 13 2017, 12:52 PM
Restricted Application added a subscriber: plasma-devel. · View Herald TranscriptJun 13 2017, 12:52 PM
davidedmundson added inline comments.
src/desktopicon.cpp
333

Normal convention for handling nested event loops (which is effectively what this is) is making a QPointer of "this" and checking that

leinir updated this revision to Diff 15421.Jun 13 2017, 1:20 PM
leinir marked an inline comment as done.

Fix glaringly obvious over-complication spotted by David :)

davidedmundson accepted this revision.Jun 13 2017, 1:25 PM
This revision is now accepted and ready to land.Jun 13 2017, 1:25 PM
This revision was automatically updated to reflect the committed changes.