Re: on launched with cocoa
Re: on launched with cocoa
- Subject: Re: on launched with cocoa
- From: "Mr. Gecko" <email@hidden>
- Date: Mon, 10 Mar 2008 13:14:00 -0500
Well I have a global that is set in a header file. In my awakeFromNib
I have it set the globals to the path of an command line tool in the
applications resource and when I run the command line tool with a
function not in the same .m file I get Segmentation fault
"EXC_BAD_ACCESS (SIGSEGV)
KERN_INVALID_ADDRESS at 0x0000000068696f82
Thread 0 Crashed:
0 objc_msgSend_rtp + 24
1 -[NSConcreteTask setLaunchPath:] + 152
2 shellScript + 248 (functions.m:17}3 scan + 144 (scan.m:34)4 -[EW
open:] + 700 (EW.m:127)5 -[NSApplication sendAction:to:from:] + 1046 -
[NSControl sendAction:to:] + 927 -[NSCell
trackMouse:inRect:ofView:untilMouseUp:] + 15848 -[NSButtonCell
trackMouse:inRect:ofView:untilMouseUp:] + 5169 -[NSControl mouseDown:]
+ 804"functions:17 is my shellScript function.
NSString *shellScript(NSString* Path, NSArray* args) {
NSPipe *outPipe = [NSPipe pipe];
NSTask* theTask = [[NSTask alloc] init];
[theTask setStandardOutput: outPipe];
[theTask setLaunchPath:Path];
[theTask setCurrentDirectoryPath:@"~/"];
[theTask setArguments: args];
[theTask launch];
[theTask waitUntilExit];
NSData *output = [[outPipe fileHandleForReading] readDataToEndOfFile];
NSString *string = [[[NSString alloc] initWithData: output encoding:
NSUTF8StringEncoding] autorelease];
return string;
}
EW.m is my controller and line 127 is where it calls my function scan
witch is in scan.m.
scan.m is where my scan function is and line 34 is
shellScript(scanner, [NSArray arrayWithObjects: @"s", location, nil])
And in awakeFromNib is where it defines scanner
Resource = [[NSBundle mainBundle] resourcePath];
scanner = [NSString stringWithFormat:@"%@/Scanner", Resource];
and that is my set up so if you see where I am messing up please tell
me. I am new to cocoa.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden