]> git.sesse.net Git - vlc/blobdiff - modules/control/hotkeys.c
Use var_Inherit* instead of var_CreateGet*.
[vlc] / modules / control / hotkeys.c
index 31e1895a15397c220c04a53aca7403a4ffaaf852..810fffa31181f85083745fecf23e7869a6d8cc16 100644 (file)
@@ -783,14 +783,14 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                                 _( "Subtitle delay %i ms" ),
                                  (int)(i_delay/1000) );
             }
-            else if( i_action == ACTIONID_SUBPOS_DOWN ||
-                     i_action == ACTIONID_SUBPOS_UP )
+            else if( i_action == ACTIONID_SUBPOS_DOWN ||
+                       i_action == ACTIONID_SUBPOS_UP ) && p_vout )
             {
                 int i_pos;
                 if( i_action == ACTIONID_SUBPOS_DOWN )
-                    i_pos = var_DecInteger( p_input, "sub-margin" );
+                    i_pos = var_DecInteger( p_vout, "sub-margin" );
                 else
-                    i_pos = var_IncInteger( p_input, "sub-margin" );
+                    i_pos = var_IncInteger( p_vout, "sub-margin" );
 
                 ClearChannels( p_intf, p_vout );
                 DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
@@ -963,22 +963,27 @@ static void PlayBookmark( intf_thread_t *p_intf, int i_num )
 static void SetBookmark( intf_thread_t *p_intf, int i_num )
 {
     char *psz_bookmark_name;
+    char *psz_uri = NULL;
     if( asprintf( &psz_bookmark_name, "bookmark%i", i_num ) == -1 )
         return;
 
     playlist_t *p_playlist = pl_Get( p_intf );
     var_Create( p_intf, psz_bookmark_name,
                 VLC_VAR_STRING|VLC_VAR_DOINHERIT );
+
+    PL_LOCK;
     playlist_item_t * p_item = playlist_CurrentPlayingItem( p_playlist );
+    if( p_item ) psz_uri = input_item_GetURI( p_item->p_input );
+    PL_UNLOCK;
+
     if( p_item )
     {
-        char *psz_uri = input_item_GetURI( p_item->p_input );
         config_PutPsz( p_intf, psz_bookmark_name, psz_uri);
         msg_Info( p_intf, "setting playlist bookmark %i to %s", i_num, psz_uri);
-        free( psz_uri );
         config_SaveConfigFile( p_intf, "hotkeys" );
     }
 
+    free( psz_uri );
     free( psz_bookmark_name );
 }