[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GWorkspace ddbd dying when mdextractor connects

From: Ivan Vučica
Subject: Re: GWorkspace ddbd dying when mdextractor connects
Date: Sun, 17 Feb 2013 18:19:00 +0100

On 17. 2. 2013., at 17:33, Riccardo Mottola <address@hidden> wrote:


On 02/16/13 22:47, Fred Kiefer wrote:
There is one strange thing I see in the code in ddbd.m. You don't retain the connection, still you release it in the -dealloc method. Most likely you should retain it in the -init method. Forgetting that, together with this code in main():
are you sure that defaultConnection returns an autoreleased object? I thought it to be equivalent of "new", just acting as a singleton.

Since we're tracking OPENSTEP and Cocoa, I think this applies:

Summarizing, unless the method name starts with "alloc", "new", "copy" or "mutableCopy" -- it's autoreleased (or equivalent of being autoreleased). That is, unless the method name starts with "allow", "new", "copy" or "mutableCopy" -- you don't get the ownership of the object, so you don't get the right to release it.

If you want to have a right to release such an object, you need to retain it.

Since the selector "defaultConnection" doesn't start with either of the strings named above, it's either autoreleased, a singleton or nil. Without looking at the code, I'd guess it's some class's class method and returns a singleton. Either way, having not been the one to instantiate the singleton (it did it itself), you can't release it. 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]