From a91f53b111400fe6a338d4b6e850ea6396167003 Mon Sep 17 00:00:00 2001 From: ale <ale@incal.net> Date: Sat, 29 Oct 2011 00:43:54 +0100 Subject: [PATCH] fix a lost NSTask reference causing bad_access errors --- client/osx-ui/DJRandomUploader/ProcessController.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/client/osx-ui/DJRandomUploader/ProcessController.m b/client/osx-ui/DJRandomUploader/ProcessController.m index cb3f78a..32e3408 100644 --- a/client/osx-ui/DJRandomUploader/ProcessController.m +++ b/client/osx-ui/DJRandomUploader/ProcessController.m @@ -18,8 +18,8 @@ // Initialization code here. curMusicFolder = @""; curApiKey = @""; - curBwLimit = [NSNumber numberWithInt:0]; - task = [[NSTask alloc] init]; + curBwLimit = [[NSNumber numberWithInt:0] retain]; + task = nil; NSBundle *bundle = [NSBundle bundleForClass:[self class]]; path = [bundle pathForAuxiliaryExecutable:@"djrandom-client"]; if (path == nil) { @@ -54,6 +54,7 @@ NSArray *args = [NSArray arrayWithObjects:@"--api_key", curApiKey, @"--music_dir", curMusicFolder, @"--debug", @"--foreground", + @"--no_realtime_watch", nil]; if ([curBwLimit intValue] > 0) { args = [args arrayByAddingObjectsFromArray:[NSArray @@ -61,7 +62,7 @@ [curBwLimit stringValue], nil]]; } NSLog(@"Starting subprocess with args: %@", args); - task = [NSTask launchedTaskWithLaunchPath:path arguments:args]; + task = [[NSTask launchedTaskWithLaunchPath:path arguments:args] retain]; } } @@ -71,7 +72,7 @@ ![bwLimit isEqualToNumber:curBwLimit]) { curMusicFolder = musicDir; curApiKey = apiKey; - curBwLimit = [bwLimit copy]; + curBwLimit = [bwLimit retain]; [self reloadProcess]; } } -- GitLab