fix a crash on quit with the QuickLook window open

This commit is contained in:
Mitchell Livingston 2009-10-12 00:48:16 +00:00
parent 99c4d8cc09
commit a01688aed6
2 changed files with 12 additions and 14 deletions

View File

@ -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;

View File

@ -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