Manually transplanted from default branch: Fix #158, the uninitialized-local-variable crash in GrowlApplicationBridge in the installer framework. Thanks to David and Sanju on the discuss list and Andrew Pennebaker on #158 for reporting this. maintenance-1.2
authorPeter Hosey <hg@boredzo.org>
Sat Sep 11 13:17:26 2010 -0700 (2010-09-11)
branchmaintenance-1.2
changeset 46607827805e9eb8
parent 4643 fde01f1a599e
child 4661 dfd0e87a3029
Manually transplanted from default branch: Fix #158, the uninitialized-local-variable crash in GrowlApplicationBridge in the installer framework. Thanks to David and Sanju on the discuss list and Andrew Pennebaker on #158 for reporting this.
Framework/Source/GrowlApplicationBridge.m
     1.1 --- a/Framework/Source/GrowlApplicationBridge.m	Fri Jul 09 11:04:14 2010 -0700
     1.2 +++ b/Framework/Source/GrowlApplicationBridge.m	Sat Sep 11 13:17:26 2010 -0700
     1.3 @@ -731,12 +731,22 @@
     1.4  
     1.5  	//First look for a running GHA. It might not actually be within a Growl prefpane bundle.
     1.6  	growlHelperAppPath = [[GrowlPathUtilities runningHelperAppBundle] bundlePath];
     1.7 -	if (!growlHelperAppPath) {
     1.8 +	if (growlHelperAppPath) {
     1.9 +		//The GHA bundle path should be: .../Growl.prefPane/Contents/Resources/GrowlHelperApp.app
    1.10 +		NSArray *growlHelperAppPathComponents = [growlHelperAppPath pathComponents];
    1.11 +		NSString *growlPrefPaneBundlePath = [NSString pathWithComponents:[growlHelperAppPathComponents subarrayWithRange:(NSRange){ 0UL, [growlHelperAppPathComponents count] - 3UL }]];
    1.12 +		growlPrefPaneBundle = [NSBundle bundleWithPath:growlPrefPaneBundlePath];
    1.13 +		//Make sure we actually got a Growl.prefPane and not, say, a Growl project folder. (NSBundle can be liberal in its acceptance of a directory as a bundle at times.)
    1.14 +		if (![[growlPrefPaneBundle bundleIdentifier] isEqualToString:GROWL_PREFPANE_BUNDLE_IDENTIFIER])
    1.15 +			growlPrefPaneBundle = nil;
    1.16 +	} else {
    1.17  		//Look for an installed-but-not-running GHA.
    1.18 -		growlPrefPaneBundle = [GrowlPathUtilities growlPrefPaneBundle];
    1.19  		growlHelperAppPath = [growlPrefPaneBundle pathForResource:@"GrowlHelperApp"
    1.20  														   ofType:@"app"];
    1.21  	}
    1.22 +	if (!growlPrefPaneBundle) {
    1.23 +		growlPrefPaneBundle = [GrowlPathUtilities growlPrefPaneBundle];
    1.24 +	}
    1.25  
    1.26  #ifdef GROWL_WITH_INSTALLER
    1.27  	if (growlPrefPaneBundle) {