From 792b5ad6f78cf4c424040f56b4ad29bb58b69051 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Sat, 15 Jan 2011 18:44:39 +0000 Subject: [PATCH] #3686 "add rpc command to cleanly shutdown daemon" - added for Mac client --- macosx/Controller.h | 3 +-- macosx/Controller.m | 11 ++++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/macosx/Controller.h b/macosx/Controller.h index 0f1182fbd..b14d2f883 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -103,8 +103,7 @@ typedef enum #warning change to QLPreviewPanel id fPreviewPanel; BOOL fQuitting; - - BOOL fUpdateInProgress; + BOOL fQuitRequested; BOOL fPauseOnLaunch; Badger * fBadger; diff --git a/macosx/Controller.m b/macosx/Controller.m index 82d112370..b522538c2 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -390,7 +390,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy [[UKKQueue sharedFileWatcher] setDelegate: self]; [[SUUpdater sharedUpdater] setDelegate: self]; - fUpdateInProgress = NO; + fQuitRequested = NO; fPauseOnLaunch = (GetCurrentKeyModifiers() & (optionKey | rightOptionKey)) != 0; } @@ -677,7 +677,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy - (NSApplicationTerminateReply) applicationShouldTerminate: (NSApplication *) sender { - if (!fUpdateInProgress && [fDefaults boolForKey: @"CheckQuit"]) + if (!fQuitRequested && [fDefaults boolForKey: @"CheckQuit"]) { NSInteger active = 0, downloading = 0; for (Torrent * torrent in fTorrents) @@ -4358,7 +4358,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy - (void) updaterWillRelaunchApplication: (SUUpdater *) updater { - fUpdateInProgress = YES; + fQuitRequested = YES; } - (NSDictionary *) registrationDictionaryForGrowl @@ -4440,6 +4440,11 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy [fPrefsController performSelectorOnMainThread: @selector(rpcUpdatePrefs) withObject: nil waitUntilDone: NO]; break; + case TR_RPC_SESSION_CLOSE: + fQuitRequested = YES; + [NSApp performSelectorOnMainThread: @selector(terminate:) withObject: self waitUntilDone: NO]; + break; + default: NSAssert1(NO, @"Unknown RPC command received: %d", type); [torrent release]; -- 2.40.0