Re: [Pyobjc-dev] NSTextView weirdness
Brought to you by:
ronaldoussoren
From: Ronald O. <ous...@ci...> - 2002-11-15 21:24:39
|
Phew, I think I found the problem with NSTextView. I've just checked in a fix for this problem, it was caused by me not quite understanding how Python does method resolution: Instead of calling __getattr__ on the class the implementation directly looks inside the class __dict__. This bypasses a hook in the __getattr__ implementation of objc_class that is used to detect Objective-C classes whose method-table have been changed since the last attribute lookup. BTW. Don't do 'NSTextView.alloc()', but always add an init* call. If you don't do this the program will crash. This is not a PyObjC problem, but a Cocoa problem ([[NSTextView alloc] release] causes a segfault). I've opened bug reports with Apple about this, the [NSTextView alloc] problem using an NSInvocation (as described earlier) and the fact that NSOutlineView doesn't call retain on model objects even if it store references to them. Ronald On Wednesday, Nov 13, 2002, at 22:24 Europe/Amsterdam, bb...@ma... wrote: > Is it the case that the class object is being released to the point of > death by the NSInvocation (and, subsequently, by the Python wrapper > for the ObjC object)? > > No... that isn't it... more like NSTextView.alloc() is returning > something similar to NSArray.alloc() that behaves in a slightly > different and more volatile fashion? > > Nuts. > > Yes, this was a part of debugging Steve's earlier problem and it still > doesn't address that problem. > >> If I evaluate NSTextView.setEditable_ before calling obj.setEditable_ >> all goes well. I'm still checking why this is necessary. > > I have not a clue and will be quite interested in the answer! > > b.bum > > On Wednesday, November 13, 2002, at 04:16 PM, Ronald Oussoren wrote: > >> Some more debugging shows: >> >> The test code is too complex, the code below also causes a crash: >> >> from AppKit import NSTextView >> NSTextView.alloc() >> >> ..... > > > > ------------------------------------------------------- > This sf.net email is sponsored by: Are you worried about your web > server security? Click here for a FREE Thawte Apache SSL Guide and > answer your Apache SSL security needs: > http://www.gothawte.com/rd523.html > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev > |