[vlc-commits] commit: Lua: do not click a button twice in a row ( Jean-Philippe André )
git at videolan.org
git at videolan.org
Sat Mar 20 19:17:26 CET 2010
vlc | branch: master | Jean-Philippe André <jpeg at videolan.org> | Sat Mar 20 19:16:08 2010 +0100| [8b61de26db061836100c9f059aa2ca66864f759c] | committer: 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.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8b61de26db061836100c9f059aa2ca66864f759c
---
modules/misc/lua/extension.c | 2 +-
modules/misc/lua/extension_thread.c | 21 ++++++++++++---------
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/modules/misc/lua/extension.c b/modules/misc/lua/extension.c
index 51769ca..5e67582 100644
--- a/modules/misc/lua/extension.c
+++ b/modules/misc/lua/extension.c
@@ -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 );
diff --git a/modules/misc/lua/extension_thread.c b/modules/misc/lua/extension_thread.c
index 1df3cf4..024949d 100644
--- a/modules/misc/lua/extension_thread.c
+++ b/modules/misc/lua/extension_thread.c
@@ -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 )
More information about the vlc-commits
mailing list