Re: [Pyobjc-dev] Headache over hacking an XML editor
Brought to you by:
ronaldoussoren
From: Ronald O. <ous...@ci...> - 2003-01-14 22:15:21
|
On Tuesday, Jan 14, 2003, at 20:55 Europe/Amsterdam, bb...@ma... wrote: > On Tuesday, Jan 14, 2003, at 14:46 US/Eastern, Just van Rossum wrote: >>> There are cases where this will not work -- Ronald has already had to >>> special case around a number of them. NSData, NSArray, and NSCell >>> (I >>> think) are examples. Not because of bugs in Foundation/AppKit, but >>> because of the implementation pattern used. >> >> So how _do_ you instantiate these classes? > > Very carefully. :-) > > Have a look at the alloc hack stuff in the source... The alloc-hack stuff is for another bug/feature of Cocoa. Some classes don't like calls to +alloc through an NSInvocation. I've opened a bugreport for this with Apple, but so far without result. You have to be a bit carefull: call alloc, some variation of init and then adjust the reference count. Doing it in another order will cause problems some times, mostly when using class clusters. Ronald |