Re: [Pyobjc-dev] Memory management bug using .new() -- and another one?
Brought to you by:
ronaldoussoren
|
From: Dirk S. <dir...@ma...> - 2009-07-08 12:07:47
|
On Jul 8, 2009, at 1:58 PM, Ronald Oussoren wrote:
>
> On 8 Jul, 2009, at 13:51, Dirk Stoop wrote:
>
>> Hi Ronald,
>>
>> Thanks for this. No worries about taking a while to get to it, I'm
>> very grateful. :)
>>
>> I'll check out r2261 to see if I can start using that revision
>> (still on 2.2b2 right now) for Checkout.
>>
>> Looking at where the problem lies, this probably also fixes the
>> problems I encountered with .new() before. Funny how those two
>> issues seem to be related again.
>
> Maybe not, the +new issue is separate from this issue. The two-line
> explanation for that issue:
>
> * The real world: +new { return [[self alloc] init]; }
> * PyObjC's world: +new { return [[[self alloc] init] autorelease]; }
>
> This causes refcount leaks because PyObjC doesn't know that it owns
> the reference that new returns, and hence should call
> -release sometime later. I have a fix for that in my tree, but
> that's to intertwined with SL related code to easily push to the
> repository.
>
> The easiest workaround for now: don't use 'SomeClass.new()' but use
> 'SomeClass.alloc().init()'.
>
> Ronald
Ah, that makes sense.
I already did a global find and replace on new() — not going back
anytime soon.
Cheers,
- Dirk
|