Cocoa: Fix unresponsive main window after running more than one modal session
For some reason, we postpone clearing the stack of modal sessions until we call processPostedEvents() again. However, it also means that when we clear the second modal session, that session keeps running although we just closed its window. The reason why it isn't stopped is because it wasn't the topmost modal session in the stack. This patch fixes the issue by stopping a modal session if any session above in the stack has been stopped. This makes it less problematic if we don't call processPostedEvents() in between ending modal sessions. Task-number: QTBUG-30504 Change-Id: I9f898250ae629947d066647f9d5a0b9f75cf0070 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
This commit is contained in:
parent
b64c9a89da
commit
61b71b2baf
@ -741,11 +741,14 @@ void QCocoaEventDispatcherPrivate::endModalSession(QWindow *window)
|
||||
// when we stop the _current_ modal session (which is the session on top of
|
||||
// the stack, and might not belong to 'window').
|
||||
int stackSize = cocoaModalSessionStack.size();
|
||||
int endedSessions = 0;
|
||||
for (int i=stackSize-1; i>=0; --i) {
|
||||
QCocoaModalSessionInfo &info = cocoaModalSessionStack[i];
|
||||
if (!info.window)
|
||||
endedSessions++;
|
||||
if (info.window == window) {
|
||||
info.window = 0;
|
||||
if (i == stackSize-1) {
|
||||
if (i + endedSessions == stackSize-1) {
|
||||
// The top sessions ended. Interrupt the event dispatcher to
|
||||
// start spinning the correct session immediately. Like in
|
||||
// beginModalSession(), we call interrupt() before clearing
|
||||
|
Loading…
Reference in New Issue
Block a user