vlc | branch: master | Victorien Le Couviour--Tuffet 
<victorien.lecouviour.tuf...@gmail.com> | Mon Nov 19 17:41:11 2018 +0100| 
[eda5eeb32204dafb03388964bb003e112c8606a3] | committer: Thomas Guillem

playlist: fix crash on clear

The playlist registers the on_media_changed callback on the player,
which accesses the items vector if the current index is not -1, since
this vector is cleared just before, it crashes. Moving the call to
ClearItems after setting the current media, and so after the callback,
fixes that.

Signed-off-by: Thomas Guillem <tho...@gllm.fr>

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

 src/playlist/content.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/playlist/content.c b/src/playlist/content.c
index 86de05ccf9..7c8fca044c 100644
--- a/src/playlist/content.c
+++ b/src/playlist/content.c
@@ -204,10 +204,10 @@ vlc_playlist_Clear(vlc_playlist_t *playlist)
 {
     vlc_playlist_AssertLocked(playlist);
 
-    vlc_playlist_ClearItems(playlist);
     int ret = vlc_player_SetCurrentMedia(playlist->player, NULL);
     VLC_UNUSED(ret); /* what could we do? */
 
+    vlc_playlist_ClearItems(playlist);
     vlc_playlist_ItemsReset(playlist);
 }
 

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to