[KDE/Mac] Review Request 124061: [OS X] avoid crashing KNode when unsubscribing from a group

René J.V. Bertin rjvbertin at gmail.com
Wed Jun 10 12:37:42 UTC 2015


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

Review request for KDE Software on Mac OS X and KDEPIM.


Repository: kdepim


Description
-------

On OS X, unsubscribing from a group with the context menu's action item (right-click on group, unsubscribe) leads to a crash systematically. Analysis of the (huge) backtrace shows that this is because a (pending?) redraw event is sent (by `qApp->processEvents()` in `KNMainWidget::secureProcessEvents`) to the group entry after it has already been deleted. (The pending event is likely to be an expose event queued when the context menu closed.)
Normally one would avoid this situation by using `deleteLater()` instead of the direct `delete`, but since `KNCollectionViewItem` does not inherit `QObject` a workaround is needed.
The attached patch implements a solution that to prevents the crashing in my testing. It disables the item to be removed in addition to setting it hidden, then updates the list (`setListItem(0)`), group and calls `qApp->processEvents()` explicitly before it is called in `KNMainWidget::secureProcessEvents()` so that pending events are processed first. The item is deleted only after those steps.

I decided not to make this modification specific to OS X (`Q_OS_MAC`) because it should not have undesirable side-effects elsewhere (and there may be other platforms where similar pending-events occur).


Diffs
-----

  knode/kncollectionview.cpp f8bce14 

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


Testing
-------

On Mac OS X 10.9.5 with KDELibs 4.14.7 and kdepim 4.13.3 (the patched function has not changed since that version).


Thanks,

René J.V. Bertin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-mac/attachments/20150610/e04e5851/attachment.html>


More information about the kde-mac mailing list