From e95f8533031771d8307c6ed54d0fe2cf0bc8da37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sat, 7 Mar 2015 09:35:29 +0100 Subject: scripts: reset current script pointer when load of script fails in python/perl/ruby/lua/tcl plugins --- src/plugins/lua/weechat-lua.c | 4 +++- src/plugins/perl/weechat-perl.c | 1 + src/plugins/python/weechat-python.c | 3 ++- src/plugins/ruby/weechat-ruby.c | 3 ++- src/plugins/tcl/weechat-tcl.c | 13 +++++++++++-- 5 files changed, 19 insertions(+), 5 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/lua/weechat-lua.c b/src/plugins/lua/weechat-lua.c index 43a4cc13f..ea2d1520b 100644 --- a/src/plugins/lua/weechat-lua.c +++ b/src/plugins/lua/weechat-lua.c @@ -425,8 +425,10 @@ weechat_lua_load (const char *filename) /* if script was registered, remove it from list */ if (lua_current_script) { - plugin_script_remove (weechat_lua_plugin, &lua_scripts, &last_lua_script, + plugin_script_remove (weechat_lua_plugin, + &lua_scripts, &last_lua_script, lua_current_script); + lua_current_script = NULL; } return 0; diff --git a/src/plugins/perl/weechat-perl.c b/src/plugins/perl/weechat-perl.c index d8c22a64b..7a3a65e45 100644 --- a/src/plugins/perl/weechat-perl.c +++ b/src/plugins/perl/weechat-perl.c @@ -438,6 +438,7 @@ weechat_perl_load (const char *filename) plugin_script_remove (weechat_perl_plugin, &perl_scripts, &last_perl_script, perl_current_script); + perl_current_script = NULL; } return 0; diff --git a/src/plugins/python/weechat-python.c b/src/plugins/python/weechat-python.c index 9f0b0019b..7a3731b26 100644 --- a/src/plugins/python/weechat-python.c +++ b/src/plugins/python/weechat-python.c @@ -722,11 +722,12 @@ weechat_python_load (const char *filename) PyErr_Print (); /* if script was registered, remove it from list */ - if (python_current_script != NULL) + if (python_current_script) { plugin_script_remove (weechat_python_plugin, &python_scripts, &last_python_script, python_current_script); + python_current_script = NULL; } Py_EndInterpreter (python_current_interpreter); diff --git a/src/plugins/ruby/weechat-ruby.c b/src/plugins/ruby/weechat-ruby.c index 11c0fe9e7..d5cb4684a 100644 --- a/src/plugins/ruby/weechat-ruby.c +++ b/src/plugins/ruby/weechat-ruby.c @@ -595,11 +595,12 @@ weechat_ruby_load (const char *filename) err = rb_gv_get("$!"); weechat_ruby_print_exception(err); - if (ruby_current_script != NULL) + if (ruby_current_script) { plugin_script_remove (weechat_ruby_plugin, &ruby_scripts, &last_ruby_script, ruby_current_script); + ruby_current_script = NULL; } return 0; diff --git a/src/plugins/tcl/weechat-tcl.c b/src/plugins/tcl/weechat-tcl.c index d0b557c26..0bb1bb50f 100644 --- a/src/plugins/tcl/weechat-tcl.c +++ b/src/plugins/tcl/weechat-tcl.c @@ -339,8 +339,17 @@ weechat_tcl_load (const char *filename) "parsing file \"%s\": %s"), weechat_prefix ("error"), TCL_PLUGIN_NAME, filename, Tcl_GetStringFromObj (Tcl_GetObjResult (interp), &i)); - /* this OK, maybe "register" was called, so not return */ - /* return 0; */ + + /* if script was registered, remove it from list */ + if (tcl_current_script) + { + plugin_script_remove (weechat_tcl_plugin, + &tcl_scripts, &last_tcl_script, + tcl_current_script); + tcl_current_script = NULL; + } + + return 0; } if (!tcl_registered_script) -- cgit v1.2.3