[vlc-devel] commit: activex: protect calls to libvlc_playlist_isplaying(). ( Jean-Paul Saman )
git version control
git at videolan.org
Sat Mar 7 17:19:41 CET 2009
vlc | branch: master | Jean-Paul Saman <jean-paul.saman at m2x.nl> | Tue Feb 24 16:23:27 2009 +0100| [09546e4b09e957a3710af1ff3a065c79275d2e75] | committer: Jean-Paul Saman
activex: protect calls to libvlc_playlist_isplaying().
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=09546e4b09e957a3710af1ff3a065c79275d2e75
---
projects/activex/vlccontrol.cpp | 8 +++++++-
projects/activex/vlccontrol2.cpp | 3 +++
2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/projects/activex/vlccontrol.cpp b/projects/activex/vlccontrol.cpp
index 75da2de..4f31cc9 100644
--- a/projects/activex/vlccontrol.cpp
+++ b/projects/activex/vlccontrol.cpp
@@ -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);
diff --git a/projects/activex/vlccontrol2.cpp b/projects/activex/vlccontrol2.cpp
index 3ce374c..e3c6965 100644
--- a/projects/activex/vlccontrol2.cpp
+++ b/projects/activex/vlccontrol2.cpp
@@ -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;
More information about the vlc-devel
mailing list