[Pyobjc-dev] Refcounting problem - idea?
Brought to you by:
ronaldoussoren
From: Jack J. <Jac...@cw...> - 2003-08-10 21:23:36
|
On zaterdag, aug 9, 2003, at 12:14 Europe/Amsterdam, Ronald Oussoren wrote: > As Martina already noted, the combobox probably doesn't retain it's > datasource. There's not much we can do about that. Cocoa seems to do > this quite often, probably to avoid reference counting cycles. Let's > hope that Apple adds a real garbage collector in the future. I was just wondering: are there *any* places where the user is expected to pass a wrapped ObjC object to a method call, and have that object be garbage collected when the call returns? Because if there aren't any such legal uses (as I expect) then we could warn about this: the wrapper code could check (just before the DECREF) that the refcount is 1 *and* the object is a wrapped ObjC object, and in that case print a warning. Down side is that it won't catch everything, of course: def awakeFromNib(self): tmp = WordTypeManager.alloc().init(self.db) self.word_type.setDataSource_(tmp) will slip through silently. -- - Jack Jansen <Jac...@or...> http://www.cwi.nl/~jack - - If I can't dance I don't want to be part of your revolution -- Emma Goldman - |