Race condition in libvlc_media_list_player_play_item_at_index
-
Configure the list player to have a list with N>1 items.
-
Call libvlc_media_list_player_play_item_at_index() repeatedly within a second (at least 6 times)
-
libvlc will crash with the following trace
(lldb) bt
* thread [#39](https://code.videolan.org/videolan/vlc/-/issues/39): tid = 0xfbd8, 0x0000000181b1d53c libsystem_pthread.dylib`pthread_mutex_lock, stop reason = EXC_BAD_ACCESS (code=1, address=0xa8)
frame [#0](https://code.videolan.org/videolan/vlc/-/issues/0): 0x0000000181b1d53c libsystem_pthread.dylib`pthread_mutex_lock
* frame [#1](https://code.videolan.org/videolan/vlc/-/issues/1): 0x0000000100216f54 VLCKit`libvlc_media_subitems [inlined] media_get_subitems(p_md=0x0000000000000000, b_create=true) + 12 at media.c:114
frame [#2](https://code.videolan.org/videolan/vlc/-/issues/2): 0x0000000100216f48 DynamicTVVLCKit`libvlc_media_subitems(p_md=0x0000000000000000) + 20 at media.c:669
frame [#3](https://code.videolan.org/videolan/vlc/-/issues/3): 0x000000010021cb3c VLCKit`libvlc_media_list_player_play_item_at_index [inlined] libvlc_media_list_item_at_path(p_mlist=0x000000013d6aa0a0, path=<unavailable>) + 60 at media_list_path.h:178
frame [#4](https://code.videolan.org/videolan/vlc/-/issues/4): 0x000000010021cb00 DynamicTVVLCKit`libvlc_media_list_player_play_item_at_index(p_mlp=0x000000013e90f9e0, i_index=<unavailable>) + 360 at media_list_player.c:695
frame [#5](https://code.videolan.org/videolan/vlc/-/issues/5): 0x00000001002089a0 VLCKit`-[VLCMediaListPlayer playItemAtNumber:](self=0x000000013eb16ce0, _cmd="playItemAtNumber:", index=(long)1) + 216 at VLCMediaListPlayer.m:187
frame [#6](https://code.videolan.org/videolan/vlc/-/issues/6): 0x0000000182883f4c Foundation`__NSThread__start__ + 1000
frame [#7](https://code.videolan.org/videolan/vlc/-/issues/7): 0x0000000181b1fb28 libsystem_pthread.dylib`_pthread_body + 156
frame [#8](https://code.videolan.org/videolan/vlc/-/issues/8): 0x0000000181b1fa8c libsystem_pthread.dylib`_pthread_start + 156
frame [#9](https://code.videolan.org/videolan/vlc/-/issues/9): 0x0000000181b1d028 libsystem_pthread.dylib`thread_start + 4
(lldb)
This is always reproducible with HEAD (a6b2f6ca).
Most likely, the media item is being deleted while it is being accessed.