Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.6.3
-
None
-
Windows 10
-
-
a545b85bdd8d227c63dda07728de4d1bac285cf5 (qt/qtbase/5.12)
Description
When a QDialog, created from a Qt::Popup is closed, this may trigger a crash.
The crash comes from that the popup is destroyed just before the QDialog is shown.
Unfortunately a pointer to that popup is kept and reused later into the event loop.
See attachment to reproduce.
1 QtSharedPointer::ExternalRefCountData::getAndRef qsharedpointer.cpp 1328 0x66acc6a9 2 QWeakPointer<QObject>::QWeakPointer<QObject><QObject> qsharedpointer_impl.h 705 0x64c89879 3 QWeakPointer<QObject>::assign<QObject> qsharedpointer_impl.h 701 0x64c8b267 4 QPointer<QWidget>::operator= qpointer.h 77 0x64cb1213 5 QWidgetWindow::handleMouseEvent qwidgetwindow.cpp 507 0x64d2ee1a 6 QWidgetWindow::event qwidgetwindow.cpp 234 0x64d2e39f 7 QApplicationPrivate::notify_helper qapplication.cpp 3804 0x64ca958b 8 QApplication::notify qapplication.cpp 3163 0x64ca577e 9 QCoreApplication::notifyInternal2 qcoreapplication.cpp 1015 0x66c8d09c 10 QCoreApplication::sendSpontaneousEvent qcoreapplication.h 228 0x66db4558 11 QGuiApplicationPrivate::processMouseEvent qguiapplication.cpp 1887 0xf26aa10 12 QGuiApplicationPrivate::processWindowSystemEvent qguiapplication.cpp 1671 0xf26cab9 13 QWindowSystemInterface::sendWindowSystemEvents qwindowsysteminterface.cpp 654 0xf23c509 14 QWindowsGuiEventDispatcher::sendPostedEvents qwindowsguieventdispatcher.cpp 76 0xffe606d 15 qt_internal_proc qeventdispatcher_win.cpp 438 0x66d223a6 16 AddClipboardFormatListener USER32 0x185be6b 17 DispatchMessageW USER32 0x185833a 18 DispatchMessageW USER32 0x1857bee 19 DispatchMessageW USER32 0x18579d0 20 QEventDispatcherWin32::processEvents qeventdispatcher_win.cpp 838 0x66d22d26 ... <plus>
A workaround is to set the Qt::WA_DeleteOnClose attribute on the popup (which, in some cases is not what the developer wants).
Maybe using QPointer<QWidget> receiver = activePopupWidget on QWidgetWindow::handleMouseEvent may avoid the crash ?