diff -r b72c6db6890b -r 5dc02b23752f src/gui/kernel/qcocoaapplicationdelegate_mac.mm --- a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm Wed Jun 23 19:07:03 2010 +0300 +++ b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm Tue Jul 06 15:10:48 2010 +0300 @@ -179,7 +179,7 @@ } // This function will only be called when NSApp is actually running. Before -// that, the kAEQuitApplication apple event will be sendt to +// that, the kAEQuitApplication Apple event will be sent to // QApplicationPrivate::globalAppleEventProcessor in qapplication_mac.mm - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender { @@ -196,21 +196,18 @@ qAppInstance()->quit(); startedQuit = false; } + return NSTerminateNow; } if (qtPrivate->threadData->eventLoops.size() == 0) { // INVARIANT: No event loop is executing. This probably // means that Qt is used as a plugin, or as a part of a native - // Cocoa application. In any case it should be fine to + // Cocoa application. In any case it should be fine to // terminate now: return NSTerminateNow; - } else { - // Prevent Cocoa from terminating the application, since this simply - // exits the program whithout allowing QApplication::exec() to return. - // The call to QApplication::quit() above will instead quit the - // application from the Qt side. - return NSTerminateCancel; } + + return NSTerminateCancel; } - (void)applicationDidFinishLaunching:(NSNotification *)aNotification @@ -317,5 +314,12 @@ qt_sendSpontaneousEvent(qAppInstance(), &qtEvent); } +- (void)appleEventQuit:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent +{ + Q_UNUSED(event); + Q_UNUSED(replyEvent); + [NSApp terminate:self]; +} + @end #endif