• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSAppleScript crash on executeAndReturnError
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSAppleScript crash on executeAndReturnError


  • Subject: Re: NSAppleScript crash on executeAndReturnError
  • From: Charles Srstka <email@hidden>
  • Date: Sun, 28 Nov 2004 19:22:41 -0600

On Nov 28, 2004, at 6:51 PM, James J. Merkel wrote:

On Nov 28, 2004, at 1:51 PM, Charles Srstka wrote:

On which line is it crashing?

It crashes on:
finderComment = [[theScript executeAndReturnError: &theError] stringValue];

That can't be, since if it were crashing here, it wouldn't be getting far enough to run your NSLog displaying the error message.


No matter, I just tried it with the code sample you posted, and it was crashing while popping the autorelease pool. After a little experimentation, I've found that the problem seems to be stemming from this line:

[theError release];

The reason is that -[NSAppleScript executeAndReturnError:(NSDictionary **)theError] returns an autoreleased dictionary in the theError variable. So, get rid of that release statement, and also change this line:

NSDictionary *theError = [[NSDictionary alloc] init];

to this:

NSDictionary *theError = nil;

to avoid a memory leak.

Charles

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSAppleScript crash on executeAndReturnError
      • From: "James J. Merkel" <email@hidden>
References: 
 >NSAppleScript crash on executeAndReturnError (From: "James J. Merkel" <email@hidden>)
 >Re: NSAppleScript crash on executeAndReturnError (From: Nick Zitzmann <email@hidden>)
 >Re: NSAppleScript crash on executeAndReturnError (From: "James J. Merkel" <email@hidden>)

  • Prev by Date: Re: NSAppleScript crash on executeAndReturnError
  • Next by Date: Hex Conversion to bytes....
  • Previous by thread: Re: NSAppleScript crash on executeAndReturnError
  • Next by thread: Re: NSAppleScript crash on executeAndReturnError
  • Index(es):
    • Date
    • Thread