Bug 225025 - QDockWidget causes apps to freeze and crash
Summary: QDockWidget causes apps to freeze and crash
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: kdeui (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords: investigated, reproducible
: 219729 222062 225489 225490 225514 225517 225621 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-01-31 18:03 UTC by Keith Rusler
Modified: 2011-12-21 23:03 UTC (History)
10 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Keith Rusler 2010-01-31 18:03:00 UTC
Version:           4.3.95 (using Devel)
Compiler:          GCC-4.4.2 -march=native
OS:                Linux
Installed from:    Compiled sources

In Dolphin, KWord, KSpreader and in my application Aki. When you move a QDockWidget on top of another one to make it tabified. It causes the application to freeze then crash. I've tried with gdb running -nofork and without it, to give a backtrace. But no backtrace is found to give an accurate report.

I've gotten other users to help verify it. Using KDE-4.3.5 with Qt-4.5 and it has no problems. But users with KDE-4.4.0 RC2 + Qt-4.6. They experience the issues also.
Comment 1 Christoph Feck 2010-01-31 18:27:48 UTC
gdb backtrace while it freezes:

#0  0xffffe424 in __kernel_vsyscall ()
#1  0xb562af16 in rename () from /lib/libc.so.6
#2  0xb6f6b7c3 in KDE::rename (in=..., out=...) at /local/svn/kde/trunk/KDE/kdelibs/kdecore/util/kde_file.h:199
#3  0xb5c6adc5 in KSaveFile::finalize (this=0xbf3bc660) at /local/svn/kde/trunk/KDE/kdelibs/kdecore/io/ksavefile.cpp:229
#4  0xb5c159a3 in KConfigIniBackend::writeConfig (this=0x80c50b0, locale=..., entryMap=..., options=..., data=...) at /local/svn/kde/trunk/KDE/kdelibs/kdecore/config/kconfigini.cpp:458
#5  0xb5bff109 in KConfig::sync (this=0x80c4df0) at /local/svn/kde/trunk/KDE/kdelibs/kdecore/config/kconfig.cpp:338
#6  0xb5c0b2d2 in KConfigGroup::sync (this=0x825efb4) at /local/svn/kde/trunk/KDE/kdelibs/kdecore/config/kconfiggroup.cpp:682
#7  0xb6d4357a in KMainWindow::saveAutoSaveSettings (this=0x8189630) at /local/svn/kde/trunk/KDE/kdelibs/kdeui/widgets/kmainwindow.cpp:1034
#8  0xb6d408ea in KMainWindowPrivate::setSettingsDirty (this=0x825efb0, callCompression=NoCompressCalls) at /local/svn/kde/trunk/KDE/kdelibs/kdeui/widgets/kmainwindow.cpp:409
#9  0xb6d43289 in KMainWindow::setSettingsDirty (this=0x8189630) at /local/svn/kde/trunk/KDE/kdelibs/kdeui/widgets/kmainwindow.cpp:971
#10 0xb6d43eb4 in KMainWindow::qt_metacall (this=0x8189630, _c=InvokeMetaMethod, _id=4, _a=0xbf3bc9e8) at /local/build/KDE/kdelibs/kdeui/kmainwindow.moc:99
#11 0xb6d87fc5 in KXmlGuiWindow::qt_metacall (this=0x8189630, _c=InvokeMetaMethod, _id=35, _a=0xbf3bc9e8) at /local/build/KDE/kdelibs/kdeui/kxmlguiwindow.moc:102
#12 0xb71cc5e2 in KParts::MainWindow::qt_metacall (this=0x8189630, _c=InvokeMetaMethod, _id=35, _a=0xbf3bc9e8) at /local/build/KDE/kdelibs/kparts/mainwindow.moc:75
#13 0xb779716a in KoMainWindow::qt_metacall (this=0x8189630, _c=InvokeMetaMethod, _id=35, _a=0xbf3bc9e8) at /local/build/koffice/libs/main/KoMainWindow.moc:128
#14 0xb5a7611d in QMetaObject::metacall (object=0x8189630, cl=153041480, idx=35, argv=0xbf3bc9e8) at kernel/qmetaobject.cpp:237
#15 0xb5a84f4a in QMetaObject::activate (sender=0x8766ec0, m=0xb6a01434, local_signal_index=3, argv=0xbf3bc9e8) at kernel/qobject.cpp:3285
#16 0xb650b3bd in QDockWidget::visibilityChanged (this=0x8766ec0, _t1=false) at .moc/release-shared/moc_qdockwidget.cpp:189
#17 0xb650ea0e in QDockWidget::event (this=0x8766ec0, event=0xbf3bce44) at widgets/qdockwidget.cpp:1396
#18 0xb60d977c in QApplicationPrivate::notify_helper (this=0x806ea90, receiver=0x8766ec0, e=0xbf3bce44) at kernel/qapplication.cpp:4298
#19 0xb60e0658 in QApplication::notify (this=0x8766ec0, receiver=0x8766ec0, e=0xbf3bce44) at kernel/qapplication.cpp:4263
#20 0xb6c4dba4 in KApplication::notify (this=0xbf87dfbc, receiver=0x8766ec0, event=0xbf3bce44) at /local/svn/kde/trunk/KDE/kdelibs/kdeui/kernel/kapplication.cpp:302
#21 0xb5a70dae in QCoreApplication::notifyInternal (this=0xbf87dfbc, receiver=0x8766ec0, event=0xbf3bce44) at kernel/qcoreapplication.cpp:704
#22 0xb6138998 in sendEvent (event=<value optimized out>, receiver=0x8744788) at ../../src/corelib/kernel/qcoreapplication.h:215
#23 QWidgetPrivate::hide_helper (event=<value optimized out>, receiver=0x8744788) at kernel/qwidget.cpp:7271
#24 0xb6142300 in QWidget::setVisible (this=0x8766ec0, visible=false) at kernel/qwidget.cpp:7444
#25 0xb650e218 in hide (this=<value optimized out>) at ../../src/gui/kernel/qwidget.h:489
#26 QDockWidgetPrivate::setWindowState (this=<value optimized out>) at widgets/qdockwidget.cpp:1021
#27 0xb650e6c7 in QDockWidgetPrivate::plug (this=0x8744788, rect=...) at widgets/qdockwidget.cpp:1004

Begin endless recursion
#28 0xb654846d in QMainWindowLayout::animationFinished (this=0x8211e60, widget=0x8766ec0) at widgets/qmainwindowlayout.cpp:1623
#29 0xb65d8836 in QWidgetAnimator::abort (this=0x82122f0, w=0x8766ec0) at widgets/qwidgetanimator.cpp:64
#30 0xb65d88b8 in QWidgetAnimator::animationFinished (this=0x82122f0) at widgets/qwidgetanimator.cpp:75
#31 0xb680e136 in QWidgetAnimator::qt_metacall (this=0x82122f0, _c=InvokeMetaMethod, _id=4, _a=0xbf3bd11c) at .moc/release-shared/moc_qwidgetanimator_p.cpp:72
#32 0xb5a7611d in QMetaObject::metacall (object=0x82122f0, cl=153041480, idx=4, argv=0xbf3bd11c) at kernel/qmetaobject.cpp:237
#33 0xb5a84f4a in QMetaObject::activate (sender=0x90dc310, m=0xb5b848d4, local_signal_index=0, argv=0x0) at kernel/qobject.cpp:3285
#34 0xb59496b5 in QAbstractAnimation::finished (this=0x90dc310) at .moc/release-shared/moc_qabstractanimation.cpp:176
#35 0xb594a518 in QAbstractAnimationPrivate::setState (this=0x91fcaa0, newState=Stopped) at animation/qabstractanimation.cpp:410
#36 0xb594a66a in QAbstractAnimation::stop (this=0x90dc310) at animation/qabstractanimation.cpp:761
#37 0xb594a794 in QAbstractAnimation::setCurrentTime (this=0x90dc310, msecs=0) at animation/qabstractanimation.cpp:718
#38 0xb594a462 in QAbstractAnimationPrivate::setState (this=0x91fcaa0, newState=Running) at animation/qabstractanimation.cpp:395
#39 0xb65d84e8 in QWidgetAnimator::animate (this=0x82122f0, widget=0x8766ec0, _final_geometry=..., animate=40) at widgets/qwidgetanimator.cpp:102
#40 0xb651935d in QDockAreaLayoutInfo::apply (this=0x8480180, animate=false) at widgets/qdockarealayout.cpp:1550
#41 0xb6544c5b in QMainWindowLayout::tabChanged (this=0x8211e60) at widgets/qmainwindowlayout.cpp:1336
#42 0xb680ab56 in QMainWindowLayout::qt_metacall (this=0x8211e60, _c=InvokeMetaMethod, _id=4, _a=0xbf3bd4b8) at .moc/release-shared/moc_qmainwindowlayout_p.cpp:72
#43 0xb5a7611d in QMetaObject::metacall (object=0x8211e60, cl=153041480, idx=4, argv=0xbf3bd4b8) at kernel/qmetaobject.cpp:237
#44 0xb5a84f4a in QMetaObject::activate (sender=0x845e8d0, m=0xb6a03374, local_signal_index=0, argv=0xbf3bd4b8) at kernel/qobject.cpp:3285
#45 0xb6595815 in QTabBar::currentChanged (this=0x845e8d0, _t1=0) at .moc/release-shared/moc_qtabbar.cpp:201
#46 0xb6597d91 in QTabBar::setCurrentIndex (this=0x845e8d0, index=0) at widgets/qtabbar.cpp:1179
#47 0xb6512077 in QDockAreaLayoutInfo::setCurrentTabId (this=0x8480180, id=141979328) at widgets/qdockarealayout.cpp:1122
End endless recursion
...
Comment 2 Christoph Feck 2010-01-31 19:27:22 UTC
David, can you please check if it is okey to always use delayed saving? If not, we could create a different private slot for the dockwidgets, so that the old public function still saves directly, but dockwidgets save delayed.

Proposed fix:

Index: kmainwindow.cpp
===================================================================
--- kmainwindow.cpp     (revision 1083149)
+++ kmainwindow.cpp     (working copy)
@@ -968,7 +968,7 @@
 void KMainWindow::setSettingsDirty()
 {
     K_D(KMainWindow);
-    d->setSettingsDirty();
+    d->setSettingsDirty(KMainWindowPrivate::CompressCalls);
 }

 bool KMainWindow::settingsDirty() const
Comment 3 Christoph Feck 2010-01-31 20:40:11 UTC
*** Bug 219729 has been marked as a duplicate of this bug. ***
Comment 4 Frank Reininghaus 2010-01-31 21:34:44 UTC
*** Bug 222062 has been marked as a duplicate of this bug. ***
Comment 5 David Faure 2010-02-02 01:40:55 UTC
Well, it looks to me like this reverts the commit below, so it doesn't look like a good solution:

r851554 | ereslibre | 2008-08-24 02:10:47 +0200 (Sun, 24 Aug 2008) 

Fix all (or almost all) toolbar problems. Now, in detail:

- We need two restoreState method calls when applying the main window settings. One before we set the toolbars again, and another after that. The first call will setup them, the second will do the
right math with them (since toolbar text position, icon size... was set).
- Actually compress potential sync's with a proper timer
- When dirtying the settings, save directly (of course, for almost all actions, not for moving or resizing, which are compressed).
This prevents us from saving incorrect settings if toolbars have been removed/changed on the meanwhile, and thus, making
QMainWindow::saveState() storing incorrect values.

===========

Anyway, I don't understand the infinite recursion (I see no trace of recursion in your backtrace, I wonder what the beginning of the "..." is). And in the code marked as infinitely recursing, there is no KDE code at all??? Sounds like a Qt bug then, no?
Comment 6 Christoph Feck 2010-02-02 23:36:59 UTC
Upstream bug report: http://bugreports.qt.nokia.com/browse/QTBUG-7857
Comment 7 Christoph Feck 2010-02-03 00:22:11 UTC
SVN commit 1084371 by cfeck:

Use QueuedConnection to work around recursion

CCBUG: 225025


 M  +1 -1      kmainwindow.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1084371
Comment 8 Christoph Feck 2010-02-03 00:24:57 UTC
SVN commit 1084374 by cfeck:

Use QueuedConnection to work around recursion (backport r1084371)

This "fixes" the upstream bug, and should probably be reverted
when the real cause of the recursion is fixed.

BUG: 225025


 M  +1 -1      kmainwindow.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1084374
Comment 9 Thomas Zander 2010-02-04 11:05:56 UTC
This fix is fine, I guess.
At the same time I wanted to add that a bug was found in Qt that caused this and is scheduled to be released with Qt462 (the next upcoming bugfix release).
Comment 10 Thomas Zander 2010-02-04 11:45:52 UTC
*** Bug 225490 has been marked as a duplicate of this bug. ***
Comment 11 Dario Andres 2010-02-05 15:53:37 UTC
*** Bug 225517 has been marked as a duplicate of this bug. ***
Comment 12 Dario Andres 2010-02-05 15:53:55 UTC
*** Bug 225489 has been marked as a duplicate of this bug. ***
Comment 13 Dario Andres 2010-02-05 15:54:02 UTC
*** Bug 225514 has been marked as a duplicate of this bug. ***
Comment 14 Dario Andres 2010-02-05 15:55:30 UTC
*** Bug 225621 has been marked as a duplicate of this bug. ***
Comment 15 Christoph Feck 2011-12-21 23:03:34 UTC
David, now that we require Qt 4.7, should this workaround be reverted?