          }
      }
      currentModalSessionCached = 0;
-@@ -923,12 +959,15 @@
+@@ -923,12 +968,15 @@
              currentModalSessionCached = info.session;
              break;
          }

 
                 if (!d->interrupt && session == d->currentModalSessionCached) {
                     // Someone called [NSApp stopModal:] from outside the event
@@ -626,8 +652,17 @@
                     // to use cocoa's native way of running modal sessions:
                     if (flags & QEventLoop::WaitForMoreEvents)
                         qt_mac_waitForMoreModalSessionEvents();

     // Add a new, empty (null), NSModalSession to the stack.
     // It will become active the next time QEventDispatcher::processEvents is called.
     // A QCocoaModalSessionInfo is considered pending to become active if the widget pointer 
@@ -958,16 +1008,20 @@
     // when we stop the _current_ modal session (which is the session on top of
     // the stack, and might not belong to 'widget'). 
     int stackSize = cocoaModalSessionStack.size();
