Summary: | Folderview crash at log-out | ||
---|---|---|---|
Product: | [Unmaintained] plasma4 | Reporter: | Frederik Himpe <fhimpe> |
Component: | widget-folderview | Assignee: | Plasma Bugs List <plasma-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | just89 |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Frederik Himpe
2008-06-22 11:43:52 UTC
Can you comment out line 173 in folderview.cpp and recompile && install and see if it fixes please. It seems to me that KNewMenu should be deleted automatically as any QWidget but it's Sunday morning... Thanks in advance! The prob is the KNewMenu* m_newMenu pointer since it will still point to the mem-address the KNewMenu* was on and didn't got set to NULL if the m_newMenu-instance got deleted. That in turn means, that each place that accessed the m_newMenu will probably deal with an invalid (aka deleted dangling) KNewMenu-pointer and crash. Following should fix it (QPointer sets m_newMenu to NULL if the KNewMenu* got deleted); Index: folderview.h =================================================================== --- folderview.h (revision 822884) +++ folderview.h (working copy) @@ -22,6 +22,7 @@ #include <QPersistentModelIndex> #include <QStyleOption> +#include <QPointer> #include <KActionCollection> @@ -133,7 +134,7 @@ bool m_viewScrolled; QString m_filterFiles; QFont m_font; - KNewMenu *m_newMenu; + QPointer<KNewMenu> m_newMenu; KActionCollection m_actionCollection; QVector<ViewItem> m_items; int m_columns; fix committed with r823000+r823001 :) *** Bug 164303 has been marked as a duplicate of this bug. *** just to complete comment #2; within folderview.cpp the line; m_newMenu = new KNewMenu(&m_actionCollection, view(), "new_menu"); does create the m_newMenu-instance. The second argument is the QObject-parent. That means, that the m_newMenu is a child of the view() and will be deleted if the view() got deleted... an alternate fix to those from comment #2 would be to; - m_newMenu = new KNewMenu(&m_actionCollection, view(), "new_menu"); + m_newMenu = new KNewMenu(&m_actionCollection, this, "new_menu"); and then we could really just remove the delete from the destructor since then the m_newMenu would be child of our folderview and deleted if the folderview got deleted. But that would also change the parentWidget (from view() to this) and looking around within the folderview.cpp shows, that operation like e.g. copy, paste, del, etc. operate on the view(). So, the QPointer-"trick" seems to be the saver (as easier to be sure no new problems got introduced) solution :) not adding any content here, but nice catch and fix, Sebastian =) |