Re: [Pyobjc-dev] issues with NSURL and NSWindow?
Brought to you by:
ronaldoussoren
From: Bob I. <bo...@re...> - 2004-04-05 04:27:35
|
On Apr 5, 2004, at 12:05 AM, b.bum wrote: > On Apr 4, 2004, at 8:59 PM, Bob Ippolito wrote: >> It's releasing something that was alloc'ed but not init'ed. It >> probably should bus error. I'm not sure how we are supposed to catch >> that anyway? I guess we would have to keep track to see if it was >> alloc'ed but not initialized, and then send it dealloc instead of >> release. >> >> This gets a bus error too, btw: >> #import <Foundation/Foundation.h> >> >> int main (int argc, char **argv) { >> NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; >> NSURL *url; >> url = [NSURL alloc]; >> [url release]; >> [pool release]; >> } > > That is a symptom of an earlier failure. The fact the PyObjC is > attempting to send initWithString instead of initWithString: is the > root cause (or else initWithString: wouldn't work, would it?). > > Can we catch the attempt to invoke a method that does not exist? That's not the correct way of looking at it. The problem is precisely that it is sending the release message to an object that is not prepared to receive it. It actually does try and throw an exception due to the incorrect selector, you just don't see it because it does some garbage collection in the process and the world ends before it gets a chance to let you know what went wrong. >>> a = NSURL.alloc() >>> del a Bus error -bob |