Commits

Anonymous committed 072f0d8

Fix behavior for apps that register multiple times, as well as a memory leak in that case.

Comments (0)

Files changed (1)

GrowlController.m

 	NSSet *allNotes = [NSSet setWithArray:[[note userInfo] objectForKey:GROWL_NOTIFICATIONS_ALL]];
 	NSSet *defaultNotes = [NSSet setWithArray:[[note userInfo] objectForKey:GROWL_NOTIFICATIONS_DEFAULT]];
 	
-	//add category to NSWorkspace for -iconForApplication later
-	NSImage *appIcon = [[NSWorkspace sharedWorkspace] iconForApplication:appName];
-	NSLog( @"AppIcon - %@", appIcon );
-	
-	GrowlApplicationTicket *newApp = [[GrowlApplicationTicket alloc] initWithApplication:appName 
-																				withIcon:appIcon
-																		andNotifications:allNotes 
-																		   andDefaultSet:defaultNotes 
-																			  fromParent:self];
-	
 	if ( ! [_tickets objectForKey:appName] ) {
+		//add category to NSWorkspace for -iconForApplication later
+		NSImage *appIcon = [[NSWorkspace sharedWorkspace] iconForApplication:appName];
+		NSLog( @"AppIcon - %@", appIcon );
+		GrowlApplicationTicket *newApp = [[GrowlApplicationTicket alloc] initWithApplication:appName 
+																					withIcon:appIcon
+																			andNotifications:allNotes 
+																			   andDefaultSet:defaultNotes 
+																				  fromParent:self];
 		[_tickets setValue:newApp forKey:appName];
 		NSLog( @"%@ has registered", appName );
 	} else {