[vlc-commits] commit: Hotkeys: playlist locking (Jakob Leben )

git at videolan.org git at videolan.org
Fri Jun 11 19:57:39 CEST 2010


vlc | branch: master | Jakob Leben <jleben at videolan.org> | Fri Jun 11 19:19:17 2010 +0200| [5d626d6a02368aff1628eaaca72fa41ec5e7a66b] | committer: Jakob Leben 

Hotkeys: playlist locking

untested

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

 modules/control/hotkeys.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index 5a06649..810fffa 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -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 );
 }
 



More information about the vlc-commits mailing list