Commit e166ec15 authored by Jean-Paul Saman's avatar Jean-Paul Saman

activex: take lock before accessing libvlc_playlist_items_count().

Patch by jan-paul dinger (jpd at m2x dot nl).
parent b9b8bcc1
......@@ -173,6 +173,8 @@ VLC_DEPRECATED_API int libvlc_playlist_isplaying( libvlc_instance_t *,
/**
* Get the number of items in the playlist
*
* Expects the playlist instance to be locked already.
*
* \param p_instance the playlist instance
* \param p_e an initialized exception pointer
* \return the number of items
......
......@@ -726,10 +726,16 @@ 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_play(p_libvlc, 0, 0, NULL, NULL);
fireOnPlayEvent();
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);
}
}
......
......@@ -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