Review Request 114921: Make KFileItemActions the parent of the actions it creates

Alex Merry kde at randomguy3.me.uk
Thu Jan 9 19:28:30 UTC 2014


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

Ship it!


I say ship it - deleting anything that has been parented to another class is definitely a bad idea.

Of course, you may want to wait for someone more familiar with this code to chime in - if there is a compelling reason for making the actions children of the relevant widget, then another approach would be to use QPointers.

- Alex Merry


On Jan. 9, 2014, 8:15 a.m., Frank Reininghaus wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/114921/
> -----------------------------------------------------------
> 
> (Updated Jan. 9, 2014, 8:15 a.m.)
> 
> 
> Review request for KDE Frameworks and David Faure.
> 
> 
> Repository: kio
> 
> 
> Description
> -------
> 
> This patch is a result of the discussion in http://lists.kde.org/?t=138687009400001&r=1&w=2
> 
> Currently, KFileItemActions makes the widget that is set with setParentWidget(QWidget*) the parent not only of any dialogs that are shown (as advertised by the API docs), but also of the created actions. Nonetheless, KFileItemActions remembers pointers to all created actions and deletes them in the destructor. This can cause problems if the widget is deleted before the KFileItemActions instance - the destructor will then try to delete dangling pointers and cause a crash.
> 
> This problem can be fixed by making KFileItemActions the parent of the actions. This also makes the code a bit simpler because the m_ownActions member is not needed any more.
> 
> In fact, this issue is the cause of crashes in Dolphin (see https://bugs.kde.org/show_bug.cgi?id=259089). I still think that we don't really have to change it in kdelibs 4.x because the problem can be worked around (https://git.reviewboard.kde.org/r/114440/ , which isn't pushed yet because it turns out that there is still another source of crashes in the problematic Dolphin use case).
> 
> 
> Diffs
> -----
> 
>   autotests/CMakeLists.txt 2868327 
>   autotests/kfileitemactionstest.cpp PRE-CREATION 
>   src/widgets/kfileitemactions.cpp eee2ebe 
>   src/widgets/kfileitemactions_p.h 9f9a701 
> 
> Diff: https://git.reviewboard.kde.org/r/114921/diff/
> 
> 
> Testing
> -------
> 
> New unit test crashes with master, and passes if the patch is applied.
> 
> Existing kio unit tests pass on my system (except for kiocore-kacltest, but I believe that the failure is unrelated to this patch).
> 
> 
> Thanks,
> 
> Frank Reininghaus
> 
>

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


More information about the Kde-frameworks-devel mailing list