[Kde-pim] Review Request 121001: prevent crashing kontact when quitting through the systray menu with more than just the main window open
René J.V. Bertin
rjvbertin at gmail.com
Wed Nov 5 20:40:49 GMT 2014
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/121001/
-----------------------------------------------------------
(Updated Nov. 5, 2014, 9:40 p.m.)
Review request for KDEPIM.
Changes
-------
fixed typo in the RR description.
Repository: kdepim
Description (updated)
-------
When Kontact exits, its `main` function calls `qDeleteAll( KMainWindow::windowList() )` in order to clean up. For a normal exit initiated through the menubar Quit action, this list appears to be emptied before the main event loop exits, so the windowList() is empty. Not so when the Quit action from the systray context menu is used. This causes a crash when there are multiple windows open (e.g. the Kontact main window plus a compose window). The main window is deleted first (successfully), presumably deleting the compose window too. The iterator loop used in `qDeleteAll` doesn't detect this, and thus tries to delete the next, already deleted resource, leading to a crash.
This is not a result of not using ->deleteLater on OS X, but a true double free that is fatal on both OS X and Linux.
The patch prevents this by replacing the `qDeleteAll` convenience function by an explicit loop that pops and deletes the head of KMainWindow::windowList() until the returned list is empty (which in my testing it is after deleting the main window).
Diffs
-----
kontact/src/main.cpp fe9f1e9
Diff: https://git.reviewboard.kde.org/r/121001/diff/
Testing
-------
On OS X 10.6.8, kdelibs git/4.14, kdepim 4.13.3
On KUbuntu 14.04, kdelibs 4.14.2, kdepim git/4.14
Thanks,
René J.V. Bertin
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/
More information about the kde-pim
mailing list