Commit 09546e4b authored by Jean-Paul Saman's avatar Jean-Paul Saman

activex: protect calls to libvlc_playlist_isplaying().

parent 4025fe2f
......@@ -203,10 +203,12 @@ STDMETHODIMP VLCControl::get_Playing(VARIANT_BOOL *isPlaying)
result = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(result) )
{
libvlc_playlist_lock( p_libvlc );
if( libvlc_playlist_isplaying(p_libvlc, NULL) )
*isPlaying = VARIANT_TRUE;
else
*isPlaying = VARIANT_FALSE;
libvlc_playlist_unlock( p_libvlc );
return NOERROR;
}
}
......@@ -354,7 +356,11 @@ STDMETHODIMP VLCControl::fullscreen(void)
result = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(result) )
{
if( libvlc_playlist_isplaying(p_libvlc, NULL) )
bool b_playing;
libvlc_playlist_lock( p_libvlc );
b_playing = libvlc_playlist_isplaying(p_libvlc, NULL);
libvlc_playlist_unlock( p_libvlc );
if( b_playing )
{
libvlc_media_player_t *p_md =
libvlc_playlist_get_media_player(p_libvlc, NULL);
......
......@@ -1706,15 +1706,18 @@ STDMETHODIMP VLCPlaylist::get_isPlaying(VARIANT_BOOL* isPlaying)
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_playlist_lock( p_libvlc );
*isPlaying = libvlc_playlist_isplaying(p_libvlc, &ex) ?
VARIANT_TRUE: VARIANT_FALSE;
if( libvlc_exception_raised(&ex) )
{
libvlc_playlist_unlock( p_libvlc );
_p_instance->setErrorInfo(IID_IVLCPlaylist,
libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
libvlc_playlist_unlock( p_libvlc );
return NOERROR;
}
return hr;
......
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