githubuser0xFFFF/Qt-Advanced-Docking-System

Random crash under Windows when changing tab

bansan85 opened this issue · 6 comments

On my application, I have a random crash under windows with Qt-Advanced-Docking-System v4.3.0 and Qt 6.7.0.

The stack:

Qt6Gui.dll!QWindow::parent(QWindow::AncestorMode mode) Line 755 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\gui\kernel\qwindow.cpp:755)
Qt6Widgets.dll!QWindowContainer::parentWasMoved(QWidget * parent) Line 427 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\widgets\kernel\qwindowcontainer.cpp:427)
Qt6Widgets.dll!qwindowcontainer_traverse(QWidget * parent, void(*)(QWidget *) callback) Line 380 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\widgets\kernel\qwindowcontainer.cpp:380)
Qt6Widgets.dll!qwindowcontainer_traverse(QWidget * parent, void(*)(QWidget *) callback) Line 380 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\widgets\kernel\qwindowcontainer.cpp:380)
[Inline Frame] Qt6Widgets.dll!QWidget::move(int) Line 881 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\widgets\kernel\qwidget.h:881)
Qt6Widgets.dll!QScrollAreaPrivate::updateWidgetPosition() Line 143 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\widgets\widgets\qscrollarea.cpp:143)
Qt6Widgets.dll!QScrollAreaPrivate::updateScrollBars() Line 192 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\widgets\widgets\qscrollarea.cpp:192)
Qt6Widgets.dll!QScrollArea::event(QEvent * e) Line 287 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\widgets\widgets\qscrollarea.cpp:287)
Qt6Widgets.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3289 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\widgets\kernel\qapplication.cpp:3289)
Qt6Widgets.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 3241 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\widgets\kernel\qapplication.cpp:3241)
Qt6Core.dll!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Line 1134 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\corelib\kernel\qcoreapplication.cpp:1134)
Qt6Widgets.dll!QWidgetPrivate::setStyle_helper(QStyle * newStyle, bool propagate) Line 2697 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\widgets\kernel\qwidget.cpp:2697)
Qt6Widgets.dll!QWidgetPrivate::inheritStyle() Line 2751 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\widgets\kernel\qwidget.cpp:2751)
Qt6Widgets.dll!QWidgetPrivate::setStyle_helper(QStyle * newStyle, bool propagate) Line 2681 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\widgets\kernel\qwidget.cpp:2681)
Qt6Widgets.dll!QWidgetPrivate::inheritStyle() Line 2751 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\widgets\kernel\qwidget.cpp:2751)
Qt6Widgets.dll!QWidget::setParent(QWidget * parent, QFlags<enum Qt::WindowType> f) Line 10863 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\widgets\kernel\qwidget.cpp:10863)
Qt6Widgets.dll!QWidget::setParent(QWidget * parent) Line 10711 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\widgets\kernel\qwidget.cpp:10711)
Qt6Widgets.dll!QLayout::addChildWidget(QWidget * w) Line 864 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\widgets\kernel\qlayout.cpp:864)
Qt6Widgets.dll!QBoxLayout::insertWidget(int index, QWidget * widget, int stretch, QFlags<enum Qt::AlignmentFlag> alignment) Line 944 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\widgets\kernel\qboxlayout.cpp:944)
Qt6Widgets.dll!QBoxLayout::addWidget(QWidget * widget, int stretch, QFlags<enum Qt::AlignmentFlag> alignment) Line 1011 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\widgets\kernel\qboxlayout.cpp:1011)
qt6advanceddocking.dll!ads::CDockAreaLayout::setCurrentIndex(int index) Line 190 (...\qt-advanced-docking-system\src\4.3.0-a471912d19.clean\src\DockAreaWidget.cpp:190)
qt6advanceddocking.dll!ads::CDockAreaWidget::setCurrentIndex(int index) Line 721 (...\qt-advanced-docking-system\src\4.3.0-a471912d19.clean\src\DockAreaWidget.cpp:721)
[Inline Frame] Qt6Core.dll!QtPrivate::QSlotObjectBase::call(QObject *) Line 469 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\corelib\kernel\qobjectdefs_impl.h:469)
Qt6Core.dll!doActivate<0>(QObject * sender, int signal_index, void * * argv) Line 4078 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\corelib\kernel\qobject.cpp:4078)
Qt6Core.dll!QMetaObject::activate(QObject * sender, const QMetaObject * m, int local_signal_index, void * * argv) Line 4139 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\corelib\kernel\qobject.cpp:4139)
qt6advanceddocking.dll!ads::CDockAreaTitleBar::tabBarClicked(int _t1) Line 295 (...\qt-advanced-docking-system\x64-windows-env-rel\src\qt6advanceddocking_autogen\EWIEGA46WW\moc_DockAreaTitleBar.cpp:295)
Qt6Core.dll!doActivate<0>(QObject * sender, int signal_index, void * * argv) Line 4095 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\corelib\kernel\qobject.cpp:4095)
Qt6Core.dll!QMetaObject::activate(QObject * sender, const QMetaObject * m, int local_signal_index, void * * argv) Line 4139 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\corelib\kernel\qobject.cpp:4139)
qt6advanceddocking.dll!ads::CDockAreaTabBar::tabBarClicked(int _t1) Line 331 (...\qt-advanced-docking-system\x64-windows-env-rel\src\qt6advanceddocking_autogen\EWIEGA46WW\moc_DockAreaTabBar.cpp:331)
qt6advanceddocking.dll!ads::CDockAreaTabBar::onTabClicked() Line 330 (...\qt-advanced-docking-system\src\4.3.0-a471912d19.clean\src\DockAreaTabBar.cpp:330)
Qt6Core.dll!doActivate<0>(QObject * sender, int signal_index, void * * argv) Line 4095 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\corelib\kernel\qobject.cpp:4095)
Qt6Core.dll!QMetaObject::activate(QObject * sender, const QMetaObject * m, int local_signal_index, void * * argv) Line 4139 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\corelib\kernel\qobject.cpp:4139)
Qt6Widgets.dll!QWidget::event(QEvent * event) Line 9463 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\widgets\kernel\qwidget.cpp:9463)
Qt6Widgets.dll!QFrame::event(QEvent * e) Line 517 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\widgets\widgets\qframe.cpp:517)
Qt6Widgets.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3289 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\widgets\kernel\qapplication.cpp:3289)
Qt6Widgets.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 2765 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\widgets\kernel\qapplication.cpp:2765)
Qt6Core.dll!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Line 1134 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\corelib\kernel\qcoreapplication.cpp:1134)
Qt6Widgets.dll!QApplicationPrivate::sendMouseEvent(QWidget * receiver, QMouseEvent * event, QWidget * alienWidget, QWidget * nativeWidget, QWidget * * buttonDown, QPointer<QWidget> & lastMouseReceiver, bool spontaneous, bool onlyDispatchEnterLeave) Line 2347 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\widgets\kernel\qapplication.cpp:2347)
Qt6Widgets.dll!QWidgetWindow::handleMouseEvent(QMouseEvent * event) Line 651 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\widgets\kernel\qwidgetwindow.cpp:651)
Qt6Widgets.dll!QWidgetWindow::event(QEvent * event) Line 264 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\widgets\kernel\qwidgetwindow.cpp:264)
Qt6Widgets.dll!QApplicationPrivate::notify_helper(QObject * receiver, QEvent * e) Line 3289 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\widgets\kernel\qapplication.cpp:3289)
Qt6Widgets.dll!QApplication::notify(QObject * receiver, QEvent * e) Line 3241 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\widgets\kernel\qapplication.cpp:3241)
Qt6Core.dll!QCoreApplication::notifyInternal2(QObject * receiver, QEvent * event) Line 1134 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\corelib\kernel\qcoreapplication.cpp:1134)
Qt6Gui.dll!QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent * e) Line 2331 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\gui\kernel\qguiapplication.cpp:2331)
Qt6Gui.dll!QWindowSystemInterface::sendWindowSystemEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 1120 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\gui\kernel\qwindowsysteminterface.cpp:1120)
Qt6Core.dll!QEventDispatcherWin32::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 470 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\corelib\kernel\qeventdispatcher_win.cpp:470)
Qt6Gui.dll!QWindowsGuiEventDispatcher::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 37 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\gui\platform\windows\qwindowsguieventdispatcher.cpp:37)
[Inline Frame] Qt6Core.dll!QEventLoop::processEvents(QFlags<enum QEventLoop::ProcessEventsFlag>) Line 100 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\corelib\kernel\qeventloop.cpp:100)
Qt6Core.dll!QEventLoop::exec(QFlags<enum QEventLoop::ProcessEventsFlag> flags) Line 181 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\corelib\kernel\qeventloop.cpp:181)
Qt6Core.dll!QCoreApplication::exec() Line 1478 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\corelib\kernel\qcoreapplication.cpp:1478)
pfrd_gui.exe!main(int argc, char * * argv) Line 130 (d:\repos\pfrd_gui\src\main.cpp:130)
pfrd_gui.exe!qtEntryPoint() Line 50 (...\qtbase\src\here-src-6-7448f7f6e6.clean\src\entrypoint\qtentrypoint_win.cpp:50)
[Inline Frame] pfrd_gui.exe!invoke_main() Line 102 (d:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:102)
pfrd_gui.exe!__scrt_common_main_seh() Line 288 (d:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
kernel32.dll!00007ff849ce257d() (Unknown Source:0)
ntdll.dll!00007ff84b90aa48() (Unknown Source:0)

You can see it's happening on a ads::CDockAreaTabBar::onTabClicked.

Did you already had this problem ? I can't send a minimal example. I'm a beginner with Qt so I only used very basic feature of docking.

I'm not sure how I can send you more information.

Can you reproduce the crash with the demo application?

No I can't reproduce. In my application, I have some QVTK widgets on my tab that use OpenGL. They can be heavy.

This morning, it crashes about one time every 10 clicks. This afternoon, it doesn't crash once. But this morning, all my CPU are at 100% due to a background compilation.

Then the problem is likely related to you application. If you dock and undock widgets, they will get reparented. This may cause a destruction of the OpenGL context - I do not know the internal of QVTK widget and if you work with shared OpenGL contexts but I hat a similar issue when using SoQT 3D widgets:

coin3d/soqt#79

So you need to ensure, that you application works properly, if your OpenGL widgets will get reparented. You can create a very basic and simple application without ADS and then move theQVTK widget into a separate window and then back into you main widget. If this works, it should also work with ADS.

Thanks for your advice. The crash occurs while changing tab, (I didn't tried while undocking / docking). But I will think about the QVTK widget and his possible side effect.

I finally found the problem. It was indeed my fault.

I had a button in a tab. This button displayed a modal window that used a widget with the tab layout as its parent.

However, by inserting the widget into the modal window (only to display the data), the parent of the widget was changed. Therefore, when the modal window was closed, the widget no longer had a valid parent and could be destroyed at any time by Qt.

Just for the record, I think this bug is still there. My tab contained a QChart that took time to show. I made a wrong mouse with my mouse: I detach the tab while the tab was not completely drawn and again, it crashes with the same stack.