[vlc-devel] [PATCH 4/7] upnp: MediaServerList::m_lock protects the access to m_list

Steve Lhomme robux4 at videolabs.io
Wed Jun 1 16:38:07 CEST 2016


parseNewServer() is called from various threads of UPNP so we need to protect
our server list
---
 modules/services_discovery/upnp.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp
index ea21b4d..5db4d0c 100644
--- a/modules/services_discovery/upnp.cpp
+++ b/modules/services_discovery/upnp.cpp
@@ -396,6 +396,8 @@ void MediaServerList::parseNewServer( IXML_Document *doc, const std::string &loc
 
     if ( !p_device_list )
         return;
+
+    vlc_mutex_locker lock( &m_lock );
     for ( unsigned int i = 0; i < ixmlNodeList_length( p_device_list ); i++ )
     {
         IXML_Element* p_device_element = ( IXML_Element* ) ixmlNodeList_item( p_device_list, i );
-- 
2.8.1



More information about the vlc-devel mailing list