[Kde-pim] Review Request 120999: don't handle events for systray when shutting down, avoiding null pointer dereference and crash
René J.V. Bertin
rjvbertin at gmail.com
Wed Nov 5 12:46:28 GMT 2014
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/120999/
-----------------------------------------------------------
(Updated Nov. 5, 2014, 12:46 p.m.)
Status
------
This change has been marked as submitted.
Review request for KDEPIM.
Repository: kdepim
Description
-------
When quitting kontact or kmail through the quit menu action it is not impossible that the process will remain active for a certain time, or even blocked in `KMKernel::cleanup()` (for instance when stuck in the "Retrieving Folder Contents" screen). During that time, kmail's systray entry will remain accessible.
The documentation for `KJob::exec` (used in `KMKernel::cleanup()`) claims that its nested event loop does not propagate UI events, but despite this, a right-click on the systray icon will result in UI events that will ultimately lead to a null pointer dereference and a crash. See the backtrace in https://bugs.kde.org/show_bug.cgi?id=340624 .
The patch proposed here prevents this by adding an additional check on `kmkernel->shuttingDown()` in `KMSystemTray::buildPopupMenu()` which prevents the crash. It does not appear to be necessary to protect `KMSystemTray::slotActivated` in a similar way, probably because it bails when there is no main window.
Note that a similar protection *may* be required in the system tray code for the other kontact components, like akregator.
Diffs
-----
kmail/kmsystemtray.cpp a960a79
Diff: https://git.reviewboard.kde.org/r/120999/diff/
Testing
-------
On Kubuntu 14.04 with KDE 4.14.2 from the kubuntu-backports PPA, and my own ppa:rjvbertin/kdepim .
With this patch, kontact can still get stuck in `KMKernel::cleanup` when struck by the frozen Retrieving Folder Contents syndrome, but right-clicking the systray icon will now bring up a small menu that allows to quit the application completely.
Side-note: this 2-step exit occurs on OS X too, even when exiting without the frozen RFC screen. Only here the global menubar remains visible, with an active Quit menu item.
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