Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.12.8
-
None
Description
Issue closing parent window during QMenu contextmenu exec on macOS
A non-modal QDialog contextmenu does not grab the mouse click focus on
macOS when being opened unlike Linux and Windows
This allows a user to leave an open contextmenu and close the MainWindow
by hitting the x on the MainWindow title bar, resulting in a crash
To recreate this bug on macOS:
unzip bug.zip
cd bug
qmake
make
open ./bug.app
In the smaller QDialog, launch its contextmenu by left clicking.
While the menu is *open*, move mouse and hit the red X in the
MainWindow titlebar. The app will crash.
See:
https://www.qtcentre.org/threads/65046-closing-parent-widget-during-QMenu-exec()
link title Dated: Jan 2016
The macOS platform should act just like Windows and Linux here and grab mouse click
focus so that any mouse click on the titlebar of the MainWindow close X will simply close
the open contextmenu.
The only workaround is to use a QPointer<QMenu> here to detect that
the menu was actually already destroyed.
As far as I know this bug exists in all version of Qt since January 2016 timeframe.
Attached a standalone test case for macOS. Same test case works just fine on Linux and Windows.
Attachments
Issue Links
- relates to
-
QTBUG-30522 macOS: Closing application window while context menu is open leaves menu open
- Closed