[PATCH] Fix KMainWindow shutdown
Michael Pyne
mpyne at purinchu.net
Thu Jan 29 02:05:49 GMT 2009
Hi all,
While valgrinding JuK's shutdown sequence I came across a lot of errors on
KMainWindowPrivate::setSettinsDirty. (example:
==18070== Invalid read of size 8
==18070== at 0x6F42F63:
KMainWindowPrivate::setSettingsDirty(KMainWindowPrivate::CallCompression)
(kmainwindow.cpp:392)
==18070== by 0x6F43235: DockResizeListener::eventFilter(QObject*, QEvent*)
(kmainwindow.cpp:121)
==18070== by 0x7CF773D:
QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*)
(qcoreapplication.cpp:710)
==18070== by 0x86F3F0F: QApplicationPrivate::notify_helper(QObject*,
QEvent*) (qapplication.cpp:4043)
==18070== by 0x86F8AE4: QApplication::notify(QObject*, QEvent*)
(qapplication.cpp:4012)
==18070== by 0x6E6FFCA: KApplication::notify(QObject*, QEvent*)
(kapplication.cpp:307)
==18070== by 0x7CF7393: QCoreApplication::notifyInternal(QObject*, QEvent*)
(qcoreapplication.cpp:594)
==18070== by 0x87412B0: QWidgetPrivate::hideChildren(bool)
(qcoreapplication.h:208)
==18070== by 0x87413D5: QWidgetPrivate::hide_helper() (qwidget.cpp:6735)
==18070== by 0x87476F2: QWidget::setVisible(bool) (qwidget.cpp:6904)
==18070== by 0x873D696: QWidget::~QWidget() (qwidget.h:472)
==18070== by 0x6F44EE8: KMainWindow::~KMainWindow() (kmainwindow.cpp:466)
Looking at the code, it's due to a DockResizeListener object installing an
event filter on the KMainWindow. The DRL itself is part of
KMainWindowPrivate, which gets deleted in the KMainWindow dtor. The DRL is
owned by by KMainWindow being deleted so as far as I see it the window where
this flaw could cause problems is small but I don't think the patch hurts
anything and I'd like to fix it anyways.
Any objections to the following patch? Otherwise I'll commit and backport to
4.2.1.
Index: kmainwindow.cpp
===================================================================
--- kmainwindow.cpp (revision 916788)
+++ kmainwindow.cpp (working copy)
@@ -461,6 +461,8 @@
KMainWindow::~KMainWindow()
{
sMemberList->removeAll( this );
+ // This can be called after the delete k_ptr while we're still alive,
kill it now
+ delete k_ptr->dockResizeListener;
delete k_ptr;
KGlobal::deref();
}
Regards,
- Michael Pyne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090128/4cd964a4/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090128/4cd964a4/attachment.sig>
More information about the kde-core-devel
mailing list