summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorMorten Sørvig <msorvig@trolltech.com>2009-05-05 16:57:07 +0200
committerMorten Sørvig <msorvig@trolltech.com>2009-05-05 16:57:07 +0200
commit91938f0be5f8ba17f669b547b92941eb7063b9e3 (patch)
tree46eb70a323c8bfa98465adb72d2a52f0697ce9a9 /src/gui/kernel
parente6d0c873c707bf076ba41924a445c0e1d343ac38 (diff)
Make command-quit not terminate the program on Qt/Cocoa.
Instead instigate the quit by calling QApplication::quit(), using the code that was already in place. This allows QApplication::exec() to return normally and prevents resrouce leaks for objects created on the stack in main(). Reviewed-by: nrc
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qcocoaapplicationdelegate_mac.mm9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm
index dad15d945e..9a246455c2 100644
--- a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm
+++ b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm
@@ -183,21 +183,24 @@ static void cleanupCocoaApplicationDelegate()
{
Q_UNUSED(sender);
// The reflection delegate gets precedence
- NSApplicationTerminateReply reply = NSTerminateCancel;
if (reflectionDelegate
&& [reflectionDelegate respondsToSelector:@selector(applicationShouldTerminate:)]) {
return [reflectionDelegate applicationShouldTerminate:sender];
}
if (qtPrivate->canQuit()) {
- reply = NSTerminateNow;
if (!startedQuit) {
startedQuit = true;
qAppInstance()->quit();
startedQuit = false;
}
}
- return reply;
+
+ // 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;
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification