macosx: add missing vlc_object_release and stuff for audio device selection
authorDavid Fuhrmann <david.fuhrmann@googlemail.com>
Sat, 16 Feb 2013 16:38:34 +0000 (17:38 +0100)
committerDavid Fuhrmann <david.fuhrmann@googlemail.com>
Sat, 16 Feb 2013 16:38:34 +0000 (17:38 +0100)
modules/gui/macosx/MainMenu.m

index 24979f0..1f67adf 100644 (file)
@@ -766,17 +766,20 @@ static VLCMainMenu *_o_sharedInstance = nil;
 - (IBAction)toggleAudioDevice:(id)sender
 {
     audio_output_t * p_aout = getAout();
+    if (!p_aout)
+        return;
 
     int returnValue = 0;
 
     if ([sender tag] > 0)
-        aout_DeviceSet(p_aout, [[NSString stringWithFormat:@"%li", [sender tag]] UTF8String]);
+        returnValue = aout_DeviceSet(p_aout, [[NSString stringWithFormat:@"%li", [sender tag]] UTF8String]);
     else
-        aout_DeviceSet(p_aout, NULL);
+        returnValue = aout_DeviceSet(p_aout, NULL);
 
     if (returnValue != 0)
         msg_Warn(VLCIntf, "failed to set audio device %li", [sender tag]);
 
+    vlc_object_release(p_aout);
     [self refreshAudioDeviceList];
 }