Commit c11e8245 authored by Jean-Philippe André's avatar Jean-Philippe André

Extensions/Qt: use lock on extensions list

parent 9f49f111
...@@ -119,6 +119,8 @@ void ExtensionsManager::menu( QMenu *current ) ...@@ -119,6 +119,8 @@ void ExtensionsManager::menu( QMenu *current )
action->setEnabled( false ); action->setEnabled( false );
current->addSeparator(); current->addSeparator();
vlc_mutex_lock( &p_extensions_manager->lock );
extension_t *p_ext = NULL; extension_t *p_ext = NULL;
int i_ext = 0; int i_ext = 0;
FOREACH_ARRAY( p_ext, p_extensions_manager->extensions ) FOREACH_ARRAY( p_ext, p_extensions_manager->extensions )
...@@ -183,6 +185,8 @@ void ExtensionsManager::menu( QMenu *current ) ...@@ -183,6 +185,8 @@ void ExtensionsManager::menu( QMenu *current )
} }
FOREACH_END() FOREACH_END()
vlc_mutex_unlock( &p_extensions_manager->lock );
/* Possibility to unload the module */ /* Possibility to unload the module */
current->addSeparator(); current->addSeparator();
current->addAction( QIcon( ":/menu/quit" ), qtr( "Unload extensions" ), current->addAction( QIcon( ":/menu/quit" ), qtr( "Unload extensions" ),
...@@ -194,6 +198,8 @@ void ExtensionsManager::triggerMenu( int id ) ...@@ -194,6 +198,8 @@ void ExtensionsManager::triggerMenu( int id )
uint16_t i_ext = MENU_GET_EXTENSION( id ); uint16_t i_ext = MENU_GET_EXTENSION( id );
uint16_t i_action = MENU_GET_ACTION( id ); uint16_t i_action = MENU_GET_ACTION( id );
vlc_mutex_lock( &p_extensions_manager->lock );
if( (int) i_ext > p_extensions_manager->extensions.i_size ) if( (int) i_ext > p_extensions_manager->extensions.i_size )
{ {
msg_Dbg( p_intf, "can't trigger extension with wrong id %d", msg_Dbg( p_intf, "can't trigger extension with wrong id %d",
...@@ -204,6 +210,8 @@ void ExtensionsManager::triggerMenu( int id ) ...@@ -204,6 +210,8 @@ void ExtensionsManager::triggerMenu( int id )
extension_t *p_ext = ARRAY_VAL( p_extensions_manager->extensions, i_ext ); extension_t *p_ext = ARRAY_VAL( p_extensions_manager->extensions, i_ext );
assert( p_ext != NULL); assert( p_ext != NULL);
vlc_mutex_unlock( &p_extensions_manager->lock );
if( i_action == 0 ) if( i_action == 0 )
{ {
msg_Dbg( p_intf, "activating or triggering extension '%s'", msg_Dbg( p_intf, "activating or triggering extension '%s'",
......
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