QMenu: clear popup screen after exec()

8cd7a3d4723ca414f3fe544704a0ccb752da94b8 remembered the current screen
in QMenuPrivate::popupScreen. This QPointer member is not reset, after
QMenu:exec(), which makes a re-used menu remember the wrong screen, if
its next usage happens on another screen.

Reset the member variable at the end of QMenuPrivate::exec().

This amends 8cd7a3d4723ca414f3fe544704a0ccb752da94b8.

Fixes: QTBUG-118434
Pick-to: 6.6 6.5
Change-Id: I7457ca72166346f01cf71b2706ebc20ecd71173c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 7aedcdefb81004f57e664409c0fb9f9b371ff4f0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Axel Spoerl 2024-03-27 16:00:37 +01:00 committed by Qt Cherry-pick Bot
parent 662dbcb8a9
commit 137706fc31

View File

@ -2674,6 +2674,7 @@ QAction *QMenuPrivate::exec(const QPoint &p, QAction *action, PositionFunction p
action = syncAction; action = syncAction;
syncAction = nullptr; syncAction = nullptr;
eventLoop = nullptr; eventLoop = nullptr;
popupScreen.clear();
return action; return action;
} }