summaryrefslogtreecommitdiff
path: root/src/plugins/scripts
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2011-02-02 22:51:38 +0100
committerSebastien Helleu <flashcode@flashtux.org>2011-02-02 22:51:38 +0100
commit372d9fe82ea829cd8cdc09a9f167508336852727 (patch)
tree6c68d18201022f5bb809d6a7217437f265317661 /src/plugins/scripts
parent49da028a2c02a9243c69d6348d3934c7e3de9658 (diff)
downloadweechat-372d9fe82ea829cd8cdc09a9f167508336852727.zip
Fix crash when many lua scripts are executing callbacks at same time
Diffstat (limited to 'src/plugins/scripts')
-rw-r--r--src/plugins/scripts/lua/weechat-lua.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/plugins/scripts/lua/weechat-lua.c b/src/plugins/scripts/lua/weechat-lua.c
index 3d3b2bcea..32db149df 100644
--- a/src/plugins/scripts/lua/weechat-lua.c
+++ b/src/plugins/scripts/lua/weechat-lua.c
@@ -151,8 +151,10 @@ weechat_lua_exec (struct t_plugin_script *script, int ret_type,
{
void *ret_value;
int argc, i, *ret_i;
+ lua_State *old_lua_current_interpreter;
struct t_plugin_script *old_lua_current_script;
+ old_lua_current_interpreter = lua_current_interpreter;
lua_current_interpreter = script->interpreter;
lua_getglobal (lua_current_interpreter, function);
@@ -191,6 +193,7 @@ weechat_lua_exec (struct t_plugin_script *script, int ret_type,
weechat_prefix ("error"), LUA_PLUGIN_NAME,
lua_tostring (lua_current_interpreter, -1));
lua_current_script = old_lua_current_script;
+ lua_current_interpreter = old_lua_current_interpreter;
return NULL;
}
@@ -212,10 +215,12 @@ weechat_lua_exec (struct t_plugin_script *script, int ret_type,
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, function);
lua_current_script = old_lua_current_script;
+ lua_current_interpreter = old_lua_current_interpreter;
return NULL;
}
lua_current_script = old_lua_current_script;
+ lua_current_interpreter = old_lua_current_interpreter;
return ret_value;
}