[vlc-commits] macosx: fix crash when audio effects panel was opened

David Fuhrmann git at videolan.org
Sun Mar 4 17:51:57 CET 2012


vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Sun Mar  4 16:24:56 2012 +0100| [73741d0175775e35447000b3b30f7e7f799d523b] | committer: Felix Paul Kühne

macosx: fix crash when audio effects panel was opened

close #6252

Signed-off-by: Felix Paul Kühne <fkuehne at videolan.org>

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

 modules/gui/macosx/AudioEffects.m |   74 ++++++++++++++++++-------------------
 1 files changed, 36 insertions(+), 38 deletions(-)

diff --git a/modules/gui/macosx/AudioEffects.m b/modules/gui/macosx/AudioEffects.m
index 22c92b2..22ae31e 100644
--- a/modules/gui/macosx/AudioEffects.m
+++ b/modules/gui/macosx/AudioEffects.m
@@ -189,51 +189,49 @@ static bool GetEqualizerStatus( intf_thread_t *p_custom_intf,
 {
     vlc_object_t *p_object = VLC_OBJECT(getAout());
     if( p_object == NULL )
-        p_object = VLC_OBJECT(pl_Get( VLCIntf ));
+        p_object = vlc_object_hold(pl_Get( p_intf ));
+
+    char *psz_preset;
+
+    var_Create( p_object, "equalizer-preset", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
+    psz_preset = var_GetNonEmptyString( p_object, "equalizer-preset" );
 
-    if( p_object )
+    for( int i = 0 ; i < NB_PRESETS ; i++ )
     {
-        char *psz_preset;
+        if( strcmp( preset_list[i], psz_preset ) )
+            continue;
 
-        var_Create( p_object, "equalizer-preset", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
-        psz_preset = var_GetNonEmptyString( p_object, "equalizer-preset" );
+        [o_eq_presets_popup selectItemWithTag:i];
 
-        for( int i = 0 ; i < NB_PRESETS ; i++ )
+        [o_eq_preamp_sld setFloatValue: eqz_preset_10b[i].f_preamp];
+        [self setBandSlidersValues: (float *)eqz_preset_10b[i].f_amp];
+
+        if( strcmp( psz_preset, "flat" ) )
         {
-            if( strcmp( preset_list[i], psz_preset ) )
-                continue;
-
-            [o_eq_presets_popup selectItemWithTag:i];
-
-            [o_eq_preamp_sld setFloatValue: eqz_preset_10b[i].f_preamp];
-            [self setBandSlidersValues: (float *)eqz_preset_10b[i].f_amp];
-
-            if( strcmp( psz_preset, "flat" ) )
-            {
-                char psz_bands[100];
-
-                snprintf( psz_bands, sizeof( psz_bands ),
-                         "%.1f %.1f %.1f %.1f %.1f %.1f %.1f "
-                         "%.1f %.1f %.1f",
-                         eqz_preset_10b[i].f_amp[0],
-                         eqz_preset_10b[i].f_amp[1],
-                         eqz_preset_10b[i].f_amp[2],
-                         eqz_preset_10b[i].f_amp[3],
-                         eqz_preset_10b[i].f_amp[4],
-                         eqz_preset_10b[i].f_amp[5],
-                         eqz_preset_10b[i].f_amp[6],
-                         eqz_preset_10b[i].f_amp[7],
-                         eqz_preset_10b[i].f_amp[8],
-                         eqz_preset_10b[i].f_amp[9] );
-
-                var_Create( p_object, "equalizer-preamp", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT );
-                var_Create( p_object, "equalizer-bands", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
-                var_SetFloat( p_object, "equalizer-preamp", eqz_preset_10b[i].f_preamp );
-                var_SetString( p_object, "equalizer-bands", psz_bands );
-            }
+            char psz_bands[100];
+
+            snprintf( psz_bands, sizeof( psz_bands ),
+                     "%.1f %.1f %.1f %.1f %.1f %.1f %.1f "
+                     "%.1f %.1f %.1f",
+                     eqz_preset_10b[i].f_amp[0],
+                     eqz_preset_10b[i].f_amp[1],
+                     eqz_preset_10b[i].f_amp[2],
+                     eqz_preset_10b[i].f_amp[3],
+                     eqz_preset_10b[i].f_amp[4],
+                     eqz_preset_10b[i].f_amp[5],
+                     eqz_preset_10b[i].f_amp[6],
+                     eqz_preset_10b[i].f_amp[7],
+                     eqz_preset_10b[i].f_amp[8],
+                     eqz_preset_10b[i].f_amp[9] );
+
+            var_Create( p_object, "equalizer-preamp", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT );
+            var_Create( p_object, "equalizer-bands", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
+            var_SetFloat( p_object, "equalizer-preamp", eqz_preset_10b[i].f_preamp );
+            var_SetString( p_object, "equalizer-bands", psz_bands );
         }
-        free( psz_preset );
     }
+    free( psz_preset );
+    vlc_object_release( p_object );
 
     [self equalizerUpdated];
 }



More information about the vlc-commits mailing list