summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@digia.com>2014-05-14 11:32:54 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-28 11:47:20 +0200
commit11fdc4f6c06922b474a311d7afb8a393686ddf13 (patch)
treefc3f8bc1a4e296248b8324f3582eb0bdc5d42a5d /src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
parent385ba9e7e3604fa181e89ae7242a6b1a36544c94 (diff)
Partially revert "Cocoa: support modal windows"
This reverts parts of commit d9875f7bff6d52a52a1d0bf4002044a5304cf6bf, in particular the code for "2. Make interrupt() use [NSApp abortModal]" abortModal is not the right way to end a modal session, and introduced bad side effects, as reported in QTBUG-34677. Restore this part of the event dispatcher to the Qt 4 state. Change-Id: Iacc2d4a0757807c87c4320c93ed4db186622945c Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm36
1 files changed, 12 insertions, 24 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
index 97b8771354..96a8fa1ad4 100644
--- a/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
+++ b/src/plugins/platforms/cocoa/qcocoaeventdispatcher.mm
@@ -721,9 +721,7 @@ void QCocoaEventDispatcherPrivate::beginModalSession(QWindow *window)
{
// We need to start spinning the modal session. Usually this is done with
// QDialog::exec() for Qt Widgets based applications, but for others that
- // just call show(), we need to interrupt(). We call this here, before
- // setting currentModalSessionCached to zero, so that interrupt() calls
- // [NSApp abortModal] if another modal session is currently running
+ // just call show(), we need to interrupt().
Q_Q(QCocoaEventDispatcher);
q->interrupt();
@@ -759,10 +757,7 @@ void QCocoaEventDispatcherPrivate::endModalSession(QWindow *window)
info.window = 0;
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
- // currentModalSessionCached to make sure we stop any currently
- // running modal session with [NSApp abortModal]
+ // start spinning the correct session immediately.
q->interrupt();
currentModalSessionCached = 0;
cleanupModalSessionsNeeded = true;
@@ -935,23 +930,16 @@ void QCocoaEventDispatcher::interrupt()
{
Q_D(QCocoaEventDispatcher);
d->interrupt = true;
- if (d->currentModalSessionCached) {
- // If a modal session is active, abort it so that we can clean it up
- // later. We can't use [NSApp stopModal] here, because we do not know
- // where the interrupt() came from.
- [NSApp abortModal];
- } else {
- wakeUp();
-
- // We do nothing more here than setting d->interrupt = true, and
- // poke the event loop if it is sleeping. Actually stopping
- // NSApp, or the current modal session, is done inside the send
- // posted events callback. We do this to ensure that all current pending
- // cocoa events gets delivered before we stop. Otherwise, if we now stop
- // the last event loop recursion, cocoa will just drop pending posted
- // events on the floor before we get a chance to reestablish a new session.
- d->cancelWaitForMoreEvents();
- }
+ wakeUp();
+
+ // We do nothing more here than setting d->interrupt = true, and
+ // poke the event loop if it is sleeping. Actually stopping
+ // NSApp, or the current modal session, is done inside the send
+ // posted events callback. We do this to ensure that all current pending
+ // cocoa events gets delivered before we stop. Otherwise, if we now stop
+ // the last event loop recursion, cocoa will just drop pending posted
+ // events on the floor before we get a chance to reestablish a new session.
+ d->cancelWaitForMoreEvents();
}
void QCocoaEventDispatcher::flush()