views:

84

answers:

1

analyze state leak problem, why?

+ (DebugOutput *) sharedDebug
    {
      @synchronized(self)
      {
        if (sharedDebugInstance == nil)
        {
          [[self alloc] init];
        }  
      }
      return sharedDebugInstance;
    }
+7  A: 

Well sharedDebugInstance is not assigned, you probably wanted to do that:

sharedDebugInstance = [[self alloc] init];
nico
have a look to this post as well: http://stackoverflow.com/questions/145154/what-does-your-objective-c-singleton-look-like
nico