Details
-
Bug
-
Resolution: Invalid
-
P2: Important
-
None
-
6.3.1, 6.4.0 Beta1
-
Windows 10 Pro 21H2, MSVC 2019 x64
Description
Steps to reproduce
#include <QtWidgets> int main(int argc, char *argv[]) { QApplication app(argc, argv); QMenu *menu = new QMenu; QObject::connect(menu, &QMenu::aboutToHide, menu, &QObject::deleteLater); QObject::connect(menu, &QMenu::destroyed, []{ qDebug("Menu is destroyed"); }); menu->addAction("Click me", qApp, [] { QMessageBox::warning(nullptr, "Warning", "It's gonna blow!"); }); menu->popup(QApplication::primaryScreen()->availableGeometry().center()); return app.exec(); }
- Build and run the above code.
- When you click the menu, you will see the QMessageBox appear and you will see the "Menu is destroyed" in the debug output.
- When you dismiss the QMessageBox, the app will crash.
Tested platforms
Customer reported this on an M1 macOS; I reproduced this on my Windows 10 machine.
Workaround
Don't delete the menu (at least not while the QMessageBox is executing)
Attachments
Issue Links
- relates to
-
QTBUG-118525 Crash if popping a StackView causes a nested event loop to run
- Closed