From a01688aed6ae7e359c8f3e5295934c4f27bc1bdb Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Mon, 12 Oct 2009 00:48:16 +0000 Subject: [PATCH] fix a crash on quit with the QuickLook window open --- macosx/Controller.h | 7 ++++--- macosx/Controller.m | 19 ++++++++----------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/macosx/Controller.h b/macosx/Controller.h index f95c27d8b..e0f865be9 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -98,6 +98,10 @@ typedef enum IBOutlet NSTextField * fURLSheetTextField; IBOutlet NSButton * fURLSheetOpenButton; + #warning change to QLPreviewPanel + id fPreviewPanel; + BOOL fQuitting; + BOOL fUpdateInProgress; BOOL fPauseOnLaunch; @@ -110,9 +114,6 @@ typedef enum NSMutableDictionary * fPendingTorrentDownloads; BOOL fSoundPlaying; - - #warning change to QLPreviewPanel - id fPreviewPanel; } - (void) openFiles: (NSArray *) filenames addType: (addType) type forcePath: (NSString *) path; diff --git a/macosx/Controller.m b/macosx/Controller.m index 165cf4318..5c86651b8 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -332,6 +332,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy [PrefsController setHandle: fLib]; fPrefsController = [[PrefsController alloc] init]; + fQuitting = NO; fSoundPlaying = NO; tr_sessionSetAltSpeedFunc(fLib, altSpeedToggledCallback, self); @@ -665,6 +666,8 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy - (void) applicationWillTerminate: (NSNotification *) notification { + fQuitting = YES; + //stop the Bonjour service [[BonjourController defaultController] stop]; @@ -703,17 +706,11 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy const BOOL quickLookOpen = [NSApp isOnSnowLeopardOrBetter] && [QLPreviewPanelSL sharedPreviewPanelExists] && [[QLPreviewPanelSL sharedPreviewPanel] isVisible]; - for (NSWindow * window in [NSApp windows]) - { - if (!quickLookOpen || window != [QLPreviewPanelSL sharedPreviewPanel]) //hide quicklook window last to avoid animation - [window orderOut: nil]; - } - if (quickLookOpen) - { - [[QLPreviewPanelSL sharedPreviewPanel] reloadData]; - [[QLPreviewPanelSL sharedPreviewPanel] orderOut: nil]; - } + [[QLPreviewPanelSL sharedPreviewPanel] updateController]; + + for (NSWindow * window in [NSApp windows]) + [window orderOut: nil]; [self showStatusBar: NO animate: NO]; [self showFilterBar: NO animate: NO]; @@ -3128,7 +3125,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy #warning change from id to QLPreviewPanel - (BOOL) acceptsPreviewPanelControl: (id) panel { - return YES; + return !fQuitting; } - (void) beginPreviewPanelControl: (id) panel -- 2.40.0