[vlc-commits] npapi: fixed event delivery reentrancy problem
Sergey Radionov
git at videolan.org
Sat Dec 24 14:40:05 CET 2011
npapi-vlc | branch: master | Sergey Radionov <RSATom at gmail.com> | Sat Dec 24 14:07:11 2011 +0700| [7c0192594e0e13df1aeab77022b92a0bb7f8b153] | committer: Jean-Baptiste Kempf
npapi: fixed event delivery reentrancy problem
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=7c0192594e0e13df1aeab77022b92a0bb7f8b153
---
npapi/vlcplugin_base.cpp | 5 +++++
npapi/vlcplugin_base.h | 3 ++-
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/npapi/vlcplugin_base.cpp b/npapi/vlcplugin_base.cpp
index c100583..d4ed630 100644
--- a/npapi/vlcplugin_base.cpp
+++ b/npapi/vlcplugin_base.cpp
@@ -203,7 +203,11 @@ EventObj::~EventObj()
void EventObj::deliver(NPP browser)
{
+ if(_already_in_deliver)
+ return;
+
plugin_lock(&lock);
+ _already_in_deliver = true;
for( ev_l::iterator iter = _elist.begin(); iter != _elist.end(); ++iter )
{
@@ -237,6 +241,7 @@ void EventObj::deliver(NPP browser)
}
_elist.clear();
+ _already_in_deliver = false;
plugin_unlock(&lock);
}
diff --git a/npapi/vlcplugin_base.h b/npapi/vlcplugin_base.h
index c9c8a59..67ffc3d 100644
--- a/npapi/vlcplugin_base.h
+++ b/npapi/vlcplugin_base.h
@@ -153,7 +153,7 @@ private:
};
libvlc_event_manager_t *_em; /* libvlc media_player event manager */
public:
- EventObj(): _em(NULL) { /* deferred to init() */ }
+ EventObj(): _em(NULL), _already_in_deliver(false) { /* deferred to init() */ }
bool init();
~EventObj();
@@ -172,6 +172,7 @@ private:
ev_l _elist; /* scheduled events list for delivery to browser */
plugin_lock_t lock;
+ bool _already_in_deliver;
};
typedef enum vlc_toolbar_clicked_e {
More information about the vlc-commits
mailing list