Commit 82bdb932 authored by Jean-Paul Saman's avatar Jean-Paul Saman Committed by Jean-Baptiste Kempf

activex: take lock before accessing libvlc_playlist_items_count().

Patch by jan-paul dinger (jpd at m2x dot nl).
parent 01876187
...@@ -726,10 +726,16 @@ HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprc ...@@ -726,10 +726,16 @@ HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprc
libvlc_video_set_parent(p_libvlc, libvlc_video_set_parent(p_libvlc,
reinterpret_cast<libvlc_drawable_t>(_inplacewnd), NULL); reinterpret_cast<libvlc_drawable_t>(_inplacewnd), NULL);
if( _b_autoplay & (libvlc_playlist_items_count(p_libvlc, NULL) > 0) ) if( _b_autoplay )
{ {
libvlc_playlist_play(p_libvlc, 0, 0, NULL, NULL); libvlc_playlist_lock(p_libvlc);
fireOnPlayEvent(); unsigned count = libvlc_playlist_items_count(p_libvlc, &ex);
if( count > 0 )
{
libvlc_playlist_play(p_libvlc, 0, 0, NULL, NULL);
fireOnPlayEvent();
}
libvlc_playlist_unlock(p_libvlc);
} }
} }
......
...@@ -939,7 +939,9 @@ STDMETHODIMP VLCControl::get_PlaylistCount(int *count) ...@@ -939,7 +939,9 @@ STDMETHODIMP VLCControl::get_PlaylistCount(int *count)
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init(&ex);
libvlc_playlist_lock(p_libvlc);
*count = libvlc_playlist_items_count(p_libvlc, &ex); *count = libvlc_playlist_items_count(p_libvlc, &ex);
libvlc_playlist_unlock(p_libvlc);
if( libvlc_exception_raised(&ex) ) if( libvlc_exception_raised(&ex) )
{ {
_p_instance->setErrorInfo(IID_IVLCControl, _p_instance->setErrorInfo(IID_IVLCControl,
......
...@@ -1526,7 +1526,9 @@ STDMETHODIMP VLCPlaylistItems::get_count(long* count) ...@@ -1526,7 +1526,9 @@ STDMETHODIMP VLCPlaylistItems::get_count(long* count)
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init(&ex);
libvlc_playlist_lock(p_libvlc);
*count = libvlc_playlist_items_count(p_libvlc, &ex); *count = libvlc_playlist_items_count(p_libvlc, &ex);
libvlc_playlist_unlock(p_libvlc);
if( libvlc_exception_raised(&ex) ) if( libvlc_exception_raised(&ex) )
{ {
_p_instance->setErrorInfo(IID_IVLCPlaylistItems, _p_instance->setErrorInfo(IID_IVLCPlaylistItems,
...@@ -1676,7 +1678,9 @@ STDMETHODIMP VLCPlaylist::get_itemCount(long* count) ...@@ -1676,7 +1678,9 @@ STDMETHODIMP VLCPlaylist::get_itemCount(long* count)
libvlc_exception_t ex; libvlc_exception_t ex;
libvlc_exception_init(&ex); libvlc_exception_init(&ex);
libvlc_playlist_lock(p_libvlc);
*count = libvlc_playlist_items_count(p_libvlc, &ex); *count = libvlc_playlist_items_count(p_libvlc, &ex);
libvlc_playlist_unlock(p_libvlc);
if( libvlc_exception_raised(&ex) ) if( libvlc_exception_raised(&ex) )
{ {
_p_instance->setErrorInfo(IID_IVLCPlaylist, _p_instance->setErrorInfo(IID_IVLCPlaylist,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment