Skip to content
Snippets Groups Projects
Commit a91f53b1 authored by ale's avatar ale
Browse files

fix a lost NSTask reference causing bad_access errors

parent e728985a
Branches
No related tags found
No related merge requests found
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
// Initialization code here. // Initialization code here.
curMusicFolder = @""; curMusicFolder = @"";
curApiKey = @""; curApiKey = @"";
curBwLimit = [NSNumber numberWithInt:0]; curBwLimit = [[NSNumber numberWithInt:0] retain];
task = [[NSTask alloc] init]; task = nil;
NSBundle *bundle = [NSBundle bundleForClass:[self class]]; NSBundle *bundle = [NSBundle bundleForClass:[self class]];
path = [bundle pathForAuxiliaryExecutable:@"djrandom-client"]; path = [bundle pathForAuxiliaryExecutable:@"djrandom-client"];
if (path == nil) { if (path == nil) {
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
NSArray *args = [NSArray NSArray *args = [NSArray
arrayWithObjects:@"--api_key", curApiKey, @"--music_dir", arrayWithObjects:@"--api_key", curApiKey, @"--music_dir",
curMusicFolder, @"--debug", @"--foreground", curMusicFolder, @"--debug", @"--foreground",
@"--no_realtime_watch",
nil]; nil];
if ([curBwLimit intValue] > 0) { if ([curBwLimit intValue] > 0) {
args = [args arrayByAddingObjectsFromArray:[NSArray args = [args arrayByAddingObjectsFromArray:[NSArray
...@@ -61,7 +62,7 @@ ...@@ -61,7 +62,7 @@
[curBwLimit stringValue], nil]]; [curBwLimit stringValue], nil]];
} }
NSLog(@"Starting subprocess with args: %@", args); NSLog(@"Starting subprocess with args: %@", args);
task = [NSTask launchedTaskWithLaunchPath:path arguments:args]; task = [[NSTask launchedTaskWithLaunchPath:path arguments:args] retain];
} }
} }
...@@ -71,7 +72,7 @@ ...@@ -71,7 +72,7 @@
![bwLimit isEqualToNumber:curBwLimit]) { ![bwLimit isEqualToNumber:curBwLimit]) {
curMusicFolder = musicDir; curMusicFolder = musicDir;
curApiKey = apiKey; curApiKey = apiKey;
curBwLimit = [bwLimit copy]; curBwLimit = [bwLimit retain];
[self reloadProcess]; [self reloadProcess];
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment