Commit 8b61de26 authored by Jean-Philippe André's avatar Jean-Philippe André

Lua: do not click a button twice in a row

Fixes #3364 (big bug on buttons)
It is not possible to click the same button twice in a row (while the
script is actually running), but other buttons can be clicked.
parent 3e21c73f
......@@ -988,7 +988,7 @@ static int vlclua_extension_dialog_callback( vlc_object_t *p_this,
{
case EXTENSION_EVENT_CLICK:
assert( p_widget != NULL );
PushCommand( p_ext, CMD_CLICK, p_widget );
PushCommandUnique( p_ext, CMD_CLICK, p_widget );
break;
case EXTENSION_EVENT_CLOSE:
PushCommandUnique( p_ext, CMD_CLOSE );
......
......@@ -267,7 +267,7 @@ int __PushCommand( extension_t *p_ext, bool b_unique, int i_command,
if( b_unique && last->i_command == i_command )
{
// Do not push this 'unique' command a second time
b_skip = true;
b_skip = !memcmp( last->data, cmd->data, sizeof( cmd->data ) );
break;
}
else
......@@ -276,7 +276,11 @@ int __PushCommand( extension_t *p_ext, bool b_unique, int i_command,
}
}
if( !b_skip )
last->next = cmd;
{
if( !b_unique || ( last->i_command != i_command )
|| memcmp( last->data, cmd->data, sizeof( cmd->data ) ) != 0 )
last->next = cmd;
}
}
vlc_cond_signal( &p_ext->p_sys->wait );
......@@ -296,12 +300,6 @@ static void* Run( void *data )
{
/* Pop command in front */
struct command_t *cmd = p_ext->p_sys->command;
if( cmd )
{
p_ext->p_sys->command = cmd->next;
cmd->next = NULL; // This prevents FreeCommands from freeing next
}
vlc_mutex_unlock( &p_ext->p_sys->command_lock );
/* Run command */
......@@ -394,7 +392,12 @@ static void* Run( void *data )
}
}
FreeCommands( cmd );
if( cmd )
{
p_ext->p_sys->command = cmd->next;
cmd->next = NULL; // This prevents FreeCommands from freeing next
FreeCommands( cmd );
}
vlc_mutex_lock( &p_ext->p_sys->command_lock );
if( !p_ext->p_sys->b_exiting && !p_ext->p_sys->command )
......
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