Skip navigation.
 
mlFW: Singleton class -init being called twice?
FROM : Ole Voss
DATE : Sun Oct 31 16:18:01 2004

> On Sun, 31 Oct 2004 08:59:06 +0100, Ole Voss <<email_removed>> wrote:

>>
>> I just noticed that the -init routine from my singleton is being called
>> twice:
>>
>> 1) When being 'alloc'ated.
>> 2) When being 'init'ed.
>>
>> Does this pose a problem or am I doing something wrong?

>
> What you just said make no sense -init only gets called when someone
> calls -init, and calling +alloc doesn't call -init. How are you
> creating your object?
>


No! You are absolutely right - I just noticed that I called the 'init' twice
myself when instantiating the static object.

    if (_globalDBManager == nil)
    {
        _globalDBManager = [[self alloc] init];
    }


And later I inited it again :-)


Ok - sorry for the trouble & thanks!


Ole.

------ End of Forwarded Message

Related mailsAuthorDate
No related mails found.