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,11 +726,17 @@ HRESULT VLCPlugin::onActivateInPlace(LPMSG lpMesg, HWND hwndParent, LPCRECT lprc
libvlc_video_set_parent(p_libvlc,
reinterpret_cast<libvlc_drawable_t>(_inplacewnd), NULL);
if( _b_autoplay & (libvlc_playlist_items_count(p_libvlc, NULL) > 0) )
if( _b_autoplay )
{
libvlc_playlist_lock(p_libvlc);
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);
}
}
if( isVisible() )
......
......@@ -939,7 +939,9 @@ STDMETHODIMP VLCControl::get_PlaylistCount(int *count)
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_playlist_lock(p_libvlc);
*count = libvlc_playlist_items_count(p_libvlc, &ex);
libvlc_playlist_unlock(p_libvlc);
if( libvlc_exception_raised(&ex) )
{
_p_instance->setErrorInfo(IID_IVLCControl,
......
......@@ -1526,7 +1526,9 @@ STDMETHODIMP VLCPlaylistItems::get_count(long* count)
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_playlist_lock(p_libvlc);
*count = libvlc_playlist_items_count(p_libvlc, &ex);
libvlc_playlist_unlock(p_libvlc);
if( libvlc_exception_raised(&ex) )
{
_p_instance->setErrorInfo(IID_IVLCPlaylistItems,
......@@ -1676,7 +1678,9 @@ STDMETHODIMP VLCPlaylist::get_itemCount(long* count)
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_playlist_lock(p_libvlc);
*count = libvlc_playlist_items_count(p_libvlc, &ex);
libvlc_playlist_unlock(p_libvlc);
if( libvlc_exception_raised(&ex) )
{
_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