[vlc-devel] [PATCH] macosx: fix crash when audio effects panel was opened
David Fuhrmann
david.fuhrmann at googlemail.com
Sun Mar 4 16:24:56 CET 2012
note: the diff looks a bit awkward, but I just removed the if and
corrected the indentation of the code block
close #6252
---
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];
}
--
1.7.7.5 (Apple Git-26)
More information about the vlc-devel
mailing list