diff --git a/macosx/Controller.m b/macosx/Controller.m index f7fd44c49..9bfdb1a86 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -198,7 +198,8 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy [fOverlayWindow release]; [fIPCController release]; - [fAutoImportedNames release]; + if (fAutoImportedNames) + [fAutoImportedNames release]; if (fPendingTorrentDownloads) [fPendingTorrentDownloads release]; @@ -442,7 +443,6 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy selector: @selector(autoSpeedLimit) userInfo: nil repeats: YES]; //auto importing - fAutoImportedNames = [[NSMutableArray alloc] init]; [self checkAutoImportDirectory]; } @@ -2022,7 +2022,8 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy fAutoImportTimer = nil; } - [fAutoImportedNames removeAllObjects]; + if (fAutoImportedNames) + [fAutoImportedNames removeAllObjects]; [self checkAutoImportDirectory]; } @@ -2040,7 +2041,11 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy //only check files that have not been checked yet NSMutableArray * newNames = [importedNames mutableCopy]; - [newNames removeObjectsInArray: fAutoImportedNames]; + + if (fAutoImportedNames) + [newNames removeObjectsInArray: fAutoImportedNames]; + else + fAutoImportedNames = [[NSMutableArray alloc] init]; [fAutoImportedNames setArray: importedNames]; NSString * file; diff --git a/macosx/PrefsController.h b/macosx/PrefsController.h index d67c69af2..e2d08c2bb 100644 --- a/macosx/PrefsController.h +++ b/macosx/PrefsController.h @@ -34,7 +34,6 @@ NSUserDefaults * fDefaults; BOOL fHasLoaded; - NSToolbar * fToolbar; IBOutlet NSView * fGeneralView, * fTransfersView, * fBandwidthView, * fNetworkView; IBOutlet NSPopUpButton * fFolderPopUp, * fIncompleteFolderPopUp, * fImportFolderPopUp, diff --git a/macosx/PrefsController.m b/macosx/PrefsController.m index f832424b0..a32840a4c 100644 --- a/macosx/PrefsController.m +++ b/macosx/PrefsController.m @@ -114,14 +114,14 @@ { fHasLoaded = YES; - fToolbar = [[NSToolbar alloc] initWithIdentifier: @"Preferences Toolbar"]; - [fToolbar setDelegate: self]; - [fToolbar setAllowsUserCustomization: NO]; - [[self window] setToolbar: fToolbar]; - [fToolbar setDisplayMode: NSToolbarDisplayModeIconAndLabel]; - [fToolbar setSizeMode: NSToolbarSizeModeRegular]; + NSToolbar * toolbar = [[NSToolbar alloc] initWithIdentifier: @"Preferences Toolbar"]; + [toolbar setDelegate: self]; + [toolbar setAllowsUserCustomization: NO]; + [toolbar setDisplayMode: NSToolbarDisplayModeIconAndLabel]; + [toolbar setSizeMode: NSToolbarSizeModeRegular]; + [[self window] setToolbar: toolbar]; - [fToolbar setSelectedItemIdentifier: TOOLBAR_GENERAL]; + [toolbar setSelectedItemIdentifier: TOOLBAR_GENERAL]; [self setPrefView: nil]; //set download folder @@ -637,10 +637,12 @@ [window setTitle: [sender label]]; else { + NSToolbar * toolbar = [window toolbar]; + NSString * itemIdentifier = [toolbar selectedItemIdentifier]; + NSEnumerator * enumerator = [[toolbar items] objectEnumerator]; NSToolbarItem * item; - NSEnumerator * enumerator = [[fToolbar items] objectEnumerator]; while ((item = [enumerator nextObject])) - if ([[item itemIdentifier] isEqualToString: [fToolbar selectedItemIdentifier]]) + if ([[item itemIdentifier] isEqualToString: itemIdentifier]) { [window setTitle: [item label]]; break;