Review Request 126385: PartManager: stop tracking a widget even if it is no longer a top level window

Jonathan Marten jjm at keelhaul.me.uk
Wed Dec 16 13:33:59 UTC 2015


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/126385/
-----------------------------------------------------------

Review request for KDE Frameworks.


Bugs: 355711
    https://bugs.kde.org/show_bug.cgi?id=355711


Repository: kparts


Description
-------

This appears to be the cause of a crash when exiting System Settings.  More information in the bug report, but basically what happens is that the manager keeps track of widgets that it is managing in d->m_managedTopLevelWidgets.  If a widget is a top level widget when it is added, but is no longer top level when it is destroyed, it is not removed from the list which results in an access-to-deleted-object in the destructor.

This change unconditionally removes the widget even if it is no longer top level.  Removing the widget from the list has no ill effects, the list is only actually used in Partmanager::eventFilter() which will never get an event for a deleted widget anyway.

Aside:  The problematic 'foreach (const QWidget *w, d->m_managedTopLevelWidgets)' loop in PartManager::PartManager() is really superfluous, since all signal connections to 'this' are removed on destruction anyway.


Diffs
-----

  src/partmanager.cpp 81bf73f 

Diff: https://git.reviewboard.kde.org/r/126385/diff/


Testing
-------

Built KParts with this change, and also systemsettings5 with the associated change (see associated review).  Observed no crash when exiting the application.  Also checked correct operation of Konqueror and Kate.


Thanks,

Jonathan Marten

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20151216/a2bb1907/attachment.html>


More information about the Kde-frameworks-devel mailing list