Review Request 114440: Fix crash if the main window is deleted inside the nested event loop of the context menu

Frank Reininghaus via Review Board noreply at kde.org
Sun Sep 29 20:31:25 BST 2019


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

(Updated Sept. 29, 2019, 7:31 p.m.)


Status
------

This change has been discarded.


Review request for Dolphin.


Bugs: 259089
    http://bugs.kde.org/show_bug.cgi?id=259089


Repository: kde-baseapps


Description
-------

We get a crash if the main window is deleted while the nested event loop of the context menu is running. The reason is that the KFileItemActions instance is currently a local variable inside a member function of the context menu. After returning from the event loop, the context menu (child of the main window) is deleted, and calling the destructor of KFileItemActions causes trouble.

This can be reproduced by (provided that only one Dolphin window is open)

sleep 5; qdbus `qdbus | grep dolphin` /dolphin/Dolphin_1/actions/file_quit trigger

and then opening the context menu in Dolphin.

The easiest solution seems to be that we make sure that KFileItemActions is destroyed at the same time as the menu, by making it a member of the context menu, rather than a local variable. This is also how it's done in Konqueor's KonqPopupMenu.

I tried to keep the diff as small as possible for the KDE/4.11 branch. There might be some potential for simplifications, but these should better be done in master.


Diffs
-----

  dolphin/src/dolphincontextmenu.h 180f917 
  dolphin/src/dolphincontextmenu.cpp f4b4698 


Diff: https://git.reviewboard.kde.org/r/114440/diff/1/


Testing
-------

Fixes the crash for me. Context menu still sees to work OK.


Thanks,

Frank Reininghaus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20190929/7fce6693/attachment.htm>


More information about the kfm-devel mailing list