Re: [Pyobjc-dev] Still struggling with NSOutlineView
Brought to you by:
ronaldoussoren
From: Just v. R. <ju...@le...> - 2003-01-18 22:02:11
|
Ronald Oussoren wrote: > > Ah, nice, thanks. That may have been a problem, but it did work for > > me before, as long as PythonItem was subclassed from NSObject. The > > main issue is that it doesn't work when it _isn't_ subclassed from > > NSObject: it crashes as soon as you click (hm, I seem to recall it > > didn't crash before your patch, maybe other PyObjC changes play a > > role...). > > It crashes when PythonItem is not subclasses from NSObject because > NSOutlineView stashes away the result of outlineView_child_ofItem_ > *without increasing its reference count*. Later on it uses this > pointer. If PythonItem is not subclassed from NSObject the values > seem by outlineView:child:ofItem: (e.g. the Objective-C > implementation) is an autoreleased proxy object (instance of > OC_PythonObject). The PythonItem instance does not contain a > reference to this proxy and therefore this will be autoreleased on > the next loop through the eventloop. If the outlineview tries to use > the proxy object later on your application goes boom. Ah, now that clears the whole thing up! Thanks much. Makes sense if you understand what happens. That's a keeper for the PyObjC phrase book, once we have one... > > Erm, where do you see a __doc__ item that's expandable? __doc__ is > > usually a stirng or None, neither of which should be expandable... > > If I start the PythonBrowser.app the window is filled with a the > globals of the module, one of these is the __doc__ (which of type > NoneType and has value None). On my system it is shown as an > expandable item, but it is not in fact expandable. > > The problem is larger than that: class AutoBaseClass is not > expandable, while NiceError is. This doesn't seem to be a problem > with the script: I've added some print-statements and those print the > expected results. This might indicate a problem with the bridge. Hm, strange. Let me know if it turns out to be a bug in my program after all... Just |