summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qeventdispatcher_mac.mm8
-rw-r--r--src/gui/kernel/qeventdispatcher_mac_p.h1
2 files changed, 7 insertions, 2 deletions
diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm
index afea3ec..62e1e81 100644
--- a/src/gui/kernel/qeventdispatcher_mac.mm
+++ b/src/gui/kernel/qeventdispatcher_mac.mm
@@ -829,6 +829,8 @@ NSModalSession QEventDispatcherMacPrivate::currentModalSession()
ensureNSAppInitialized();
QBoolBlocker block1(blockSendPostedEvents, true);
+ info.nswindow = window;
+ [(NSWindow*) info.nswindow retain];
info.session = [NSApp beginModalSessionForWindow:window];
}
currentModalSessionCached = info.session;
@@ -903,8 +905,10 @@ void QEventDispatcherMacPrivate::cleanupModalSessions()
}
cocoaModalSessionStack.remove(i);
currentModalSessionCached = 0;
- if (info.session)
+ if (info.session) {
[NSApp endModalSession:info.session];
+ [(NSWindow *)info.nswindow release];
+ }
}
updateChildrenWorksWhenModal();
@@ -920,7 +924,7 @@ void QEventDispatcherMacPrivate::beginModalSession(QWidget *widget)
// currentModalSession). A QCocoaModalSessionInfo is considered pending to be stopped if
// the widget pointer is zero, and the session pointer is non-zero (it will be fully
// stopped in cleanupModalSessions()).
- QCocoaModalSessionInfo info = {widget, 0};
+ QCocoaModalSessionInfo info = {widget, 0, 0};
cocoaModalSessionStack.push(info);
updateChildrenWorksWhenModal();
currentModalSessionCached = 0;
diff --git a/src/gui/kernel/qeventdispatcher_mac_p.h b/src/gui/kernel/qeventdispatcher_mac_p.h
index e932532..8ac7c65 100644
--- a/src/gui/kernel/qeventdispatcher_mac_p.h
+++ b/src/gui/kernel/qeventdispatcher_mac_p.h
@@ -100,6 +100,7 @@ typedef struct _NSModalSession *NSModalSession;
typedef struct _QCocoaModalSessionInfo {
QPointer<QWidget> widget;
NSModalSession session;
+ void *nswindow;
} QCocoaModalSessionInfo;
#endif