[vlc-commits] upnp: Fix race condition when invoking callbacks
Hugo Beauzée-Luyssen
git at videolan.org
Wed Nov 21 15:33:35 CET 2018
vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Tue Nov 20 11:52:25 2018 +0100| [a8249ee42bcff8dbedccbf588f04dc23fe05877e] | committer: Hugo Beauzée-Luyssen
upnp: Fix race condition when invoking callbacks
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a8249ee42bcff8dbedccbf588f04dc23fe05877e
---
modules/services_discovery/upnp-wrapper.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/modules/services_discovery/upnp-wrapper.cpp b/modules/services_discovery/upnp-wrapper.cpp
index 3e924274dc..95b1847c79 100644
--- a/modules/services_discovery/upnp-wrapper.cpp
+++ b/modules/services_discovery/upnp-wrapper.cpp
@@ -34,6 +34,7 @@
#endif
#include "upnp-wrapper.hpp"
+#include <vlc_cxx_helpers.hpp>
UpnpInstanceWrapper* UpnpInstanceWrapper::s_instance;
UpnpInstanceWrapper::Listeners UpnpInstanceWrapper::s_listeners;
@@ -129,6 +130,7 @@ UpnpClient_Handle UpnpInstanceWrapper::handle() const
int UpnpInstanceWrapper::Callback(Upnp_EventType event_type, UpnpEventPtr p_event, void *p_user_data)
{
+ vlc::threads::mutex_locker lock( &s_lock );
for (Listeners::iterator iter = s_listeners.begin(); iter != s_listeners.end(); ++iter)
{
(*iter)->onEvent(event_type, p_event, p_user_data);
More information about the vlc-commits
mailing list