Don't leak plug-in instances. Found by the analyzer.
authorPeter Hosey <hg@boredzo.org>
Sat Sep 26 17:36:20 2009 -0700 (2009-09-26)
changeset 4441e4bc764cf865
parent 4440 14c4abac0637
child 4442 e6763de09830
Don't leak plug-in instances. Found by the analyzer.
Core/Source/GrowlPluginController.m
     1.1 --- a/Core/Source/GrowlPluginController.m	Sat Sep 26 17:36:20 2009 -0700
     1.2 +++ b/Core/Source/GrowlPluginController.m	Sat Sep 26 17:36:20 2009 -0700
     1.3 @@ -393,7 +393,7 @@
     1.4  			[bundlesToLazilyInstantiateAnInstanceFrom addObject:bundle];
     1.5  		} else {
     1.6  			//We have: This is our cue to instantiate it.
     1.7 -			plugin = [[[bundle principalClass] alloc] init];
     1.8 +			plugin = [[[[bundle principalClass] alloc] init] autorelease];
     1.9  			//Dequeue it, because we don't want to hit this branch again for this plug-in.
    1.10  			[bundlesToLazilyInstantiateAnInstanceFrom removeObject:bundle];
    1.11  			//Stash the plug-in instance in the plug-in dictionary. This retains the instance and means that we'll never hit the lazy-instantiation machinery again (because plugin will be non-nil).
    1.12 @@ -407,7 +407,7 @@
    1.13  			[bundlesToLazilyInstantiateAnInstanceFrom addObject:bundle];
    1.14  		else {
    1.15  			//Apparently it is. Instantiate it, but don't stash the plug-in instance in the plug-in dictionary (why not?).
    1.16 -			plugin = [[[bundle principalClass] alloc] init];
    1.17 +			plugin = [[[[bundle principalClass] alloc] init] autorelease];
    1.18  			[bundlesToLazilyInstantiateAnInstanceFrom removeObject:bundle];
    1.19  		}
    1.20  	}