[vlc-commits] growl: drop legacy NSAutoreleasePool pattern

Felix Paul Kühne git at videolan.org
Thu Sep 3 11:16:27 CEST 2015


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Thu Sep  3 11:15:41 2015 +0200| [e8aaffa24dac95ba65d740e487932013a11fe17f] | committer: Felix Paul Kühne

growl: drop legacy NSAutoreleasePool pattern

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e8aaffa24dac95ba65d740e487932013a11fe17f
---

 modules/notify/growl.m |   55 ++++++++++++++++++++++++------------------------
 1 file changed, 27 insertions(+), 28 deletions(-)

diff --git a/modules/notify/growl.m b/modules/notify/growl.m
index 1eac19d..cf00144 100644
--- a/modules/notify/growl.m
+++ b/modules/notify/growl.m
@@ -279,38 +279,37 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
 
 - (void)registerToGrowl
 {
-    o_applicationName = [[NSString alloc] initWithUTF8String: _( "VLC media player" )];
-    o_notificationType = [[NSString alloc] initWithUTF8String: _( "New input playing" )];
-
-    NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
-    NSArray *o_defaultAndAllNotifications = [NSArray arrayWithObject: o_notificationType];
-
-    o_registrationDictionary = [[NSMutableDictionary alloc] init];
-    [o_registrationDictionary setObject: o_defaultAndAllNotifications
-                                 forKey: GROWL_NOTIFICATIONS_ALL];
-    [o_registrationDictionary setObject: o_defaultAndAllNotifications
-                                 forKey: GROWL_NOTIFICATIONS_DEFAULT];
-
-    [GrowlApplicationBridge setGrowlDelegate: self];
-    [o_pool drain];
+    @autoreleasepool {
+        o_applicationName = [[NSString alloc] initWithUTF8String: _( "VLC media player" )];
+        o_notificationType = [[NSString alloc] initWithUTF8String: _( "New input playing" )];
+
+        NSArray *o_defaultAndAllNotifications = [NSArray arrayWithObject: o_notificationType];
+        o_registrationDictionary = [[NSMutableDictionary alloc] init];
+        [o_registrationDictionary setObject: o_defaultAndAllNotifications
+                                     forKey: GROWL_NOTIFICATIONS_ALL];
+        [o_registrationDictionary setObject: o_defaultAndAllNotifications
+                                     forKey: GROWL_NOTIFICATIONS_DEFAULT];
+
+        [GrowlApplicationBridge setGrowlDelegate: self];
+    }
 }
 
 - (void)notifyWithDescription: (const char *)psz_desc artUrl: (const char *)psz_arturl
 {
-    NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
-    NSData *o_art = nil;
-
-    if( psz_arturl )
-        o_art = [NSData dataWithContentsOfFile: [NSString stringWithUTF8String: psz_arturl]];
-
-    [GrowlApplicationBridge notifyWithTitle: [NSString stringWithUTF8String: _( "Now playing" )]
-                                description: [NSString stringWithUTF8String: psz_desc]
-                           notificationName: o_notificationType
-                                   iconData: o_art
-                                   priority: 0
-                                   isSticky: NO
-                               clickContext: nil];
-    [o_pool drain];
+    @autoreleasepool {
+        NSData *o_art = nil;
+
+        if( psz_arturl )
+            o_art = [NSData dataWithContentsOfFile: [NSString stringWithUTF8String: psz_arturl]];
+
+        [GrowlApplicationBridge notifyWithTitle: [NSString stringWithUTF8String: _( "Now playing" )]
+                                    description: [NSString stringWithUTF8String: psz_desc]
+                               notificationName: o_notificationType
+                                       iconData: o_art
+                                       priority: 0
+                                       isSticky: NO
+                                   clickContext: nil];
+    }
 }
 
 /*****************************************************************************



More information about the vlc-commits mailing list