[vlc-devel] commit: Fix segfault: press Shift+A without an opened AOUT would crash. ( Jean-Philippe Andre )
git version control
git at videolan.org
Sat Apr 11 07:34:03 CEST 2009
vlc | branch: master | Jean-Philippe Andre <jpeg at via.ecp.fr> | Sat Apr 11 13:16:25 2009 +0800| [c7b874c515c653161b5019a7245e3fd314230ae0] | committer: Jean-Philippe Andre
Fix segfault: press Shift+A without an opened AOUT would crash.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c7b874c515c653161b5019a7245e3fd314230ae0
---
modules/control/hotkeys.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index 4ed3ee5..1c859bc 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -162,6 +162,7 @@ static void Close( vlc_object_t *p_this )
static void Run( intf_thread_t *p_intf )
{
vout_thread_t *p_vout = NULL;
+ aout_instance_t *p_aout = NULL;
vlc_value_t val;
playlist_t *p_playlist = pl_Hold( p_intf );
int canc = vlc_savecancel();
@@ -194,6 +195,9 @@ static void Run( intf_thread_t *p_intf )
p_last_vout = p_vout;
p_vout = p_input ? input_GetVout( p_input ) : NULL;
+ /* Update the aout */
+ p_aout = p_input ? input_GetAout( p_input ) : NULL;
+
/* Register OSD channels */
if( p_vout && p_vout != p_last_vout )
{
@@ -371,13 +375,11 @@ static void Run( intf_thread_t *p_intf )
playlist_Play( p_playlist );
}
}
- else if( i_action == ACTIONID_AUDIODEVICE_CYCLE )
+ else if( ( i_action == ACTIONID_AUDIODEVICE_CYCLE ) && p_aout )
{
vlc_value_t val, list, list2;
int i_count, i;
- aout_instance_t *p_aout =
- vlc_object_find( p_intf, VLC_OBJECT_AOUT, FIND_ANYWHERE );
var_Get( p_aout, "audio-device", &val );
var_Change( p_aout, "audio-device", VLC_VAR_GETCHOICES,
&list, &list2 );
@@ -417,7 +419,6 @@ static void Run( intf_thread_t *p_intf )
vout_OSDMessage( p_intf, DEFAULT_CHAN,
_("Audio Device: %s"),
list2.p_list->p_values[i].psz_string);
- vlc_object_release( p_aout );
}
/* Input options */
else if( p_input )
@@ -912,6 +913,8 @@ static void Run( intf_thread_t *p_intf )
}
}
}
+ if( p_aout )
+ vlc_object_release( p_aout );
if( p_vout )
vlc_object_release( p_vout );
if( p_input )
More information about the vlc-devel
mailing list