From 7a80558d0f179d0c007556f41a73c3d90bb4a171 Mon Sep 17 00:00:00 2001 From: Emmanuel Bouthenot Date: Tue, 6 Dec 2005 22:38:06 +0000 Subject: [PATCH] fix various minor bugs in plugins scripts --- src/plugins/scripts/perl/weechat-perl.c | 4 +--- src/plugins/scripts/python/weechat-python.c | 2 -- src/plugins/scripts/ruby/weechat-ruby.c | 6 ++++-- weechat/src/plugins/scripts/perl/weechat-perl.c | 4 +--- weechat/src/plugins/scripts/python/weechat-python.c | 2 -- weechat/src/plugins/scripts/ruby/weechat-ruby.c | 6 ++++-- 6 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/plugins/scripts/perl/weechat-perl.c b/src/plugins/scripts/perl/weechat-perl.c index c46f78480..ab4513972 100644 --- a/src/plugins/scripts/perl/weechat-perl.c +++ b/src/plugins/scripts/perl/weechat-perl.c @@ -138,8 +138,6 @@ weechat_perl_exec (t_weechat_plugin *plugin, count = perl_call_argv (func, G_EVAL | G_SCALAR, argv); - perl_current_script = NULL; - SPAGAIN; sv = GvSV (gv_fetchpv ("@", TRUE, SVt_PV)); @@ -917,7 +915,7 @@ weechat_perl_load (t_weechat_plugin *plugin, char *filename) perl_destruct (perl_current_interpreter); perl_free (perl_current_interpreter); #endif - if (perl_current_script != NULL) + if ((perl_current_script != NULL) && (perl_current_script != &tempscript)) weechat_script_remove (plugin, &perl_scripts, perl_current_script); return 0; diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c index 85be78a40..00728bba5 100644 --- a/src/plugins/scripts/python/weechat-python.c +++ b/src/plugins/scripts/python/weechat-python.c @@ -78,8 +78,6 @@ weechat_python_exec (t_weechat_plugin *plugin, rc = PyObject_CallFunction(evFunc, "ss", server == NULL ? "" : server, arguments == NULL ? "" : arguments); - python_current_script = NULL; - if (rc) { ret = (int) PyInt_AsLong(rc); diff --git a/src/plugins/scripts/ruby/weechat-ruby.c b/src/plugins/scripts/ruby/weechat-ruby.c index a850c0ff0..29c51e215 100644 --- a/src/plugins/scripts/ruby/weechat-ruby.c +++ b/src/plugins/scripts/ruby/weechat-ruby.c @@ -126,8 +126,6 @@ weechat_ruby_exec (t_weechat_plugin *plugin, &ruby_error, 2, rb_str_new2((server == NULL) ? "" : server), rb_str_new2((arguments == NULL) ? "" : arguments)); - ruby_current_script = NULL; - if (ruby_error) { VALUE ruby_error_info = rb_inspect(ruby_errinfo); @@ -996,6 +994,10 @@ weechat_ruby_load (t_weechat_plugin *plugin, char *filename) filename); ruby_plugin->printf_server (ruby_plugin, "Ruby error: %s", STR2CSTR(ruby_error_info)); + + if (ruby_current_script != NULL) + weechat_script_remove (plugin, &ruby_scripts, ruby_current_script); + return 0; } diff --git a/weechat/src/plugins/scripts/perl/weechat-perl.c b/weechat/src/plugins/scripts/perl/weechat-perl.c index c46f78480..ab4513972 100644 --- a/weechat/src/plugins/scripts/perl/weechat-perl.c +++ b/weechat/src/plugins/scripts/perl/weechat-perl.c @@ -138,8 +138,6 @@ weechat_perl_exec (t_weechat_plugin *plugin, count = perl_call_argv (func, G_EVAL | G_SCALAR, argv); - perl_current_script = NULL; - SPAGAIN; sv = GvSV (gv_fetchpv ("@", TRUE, SVt_PV)); @@ -917,7 +915,7 @@ weechat_perl_load (t_weechat_plugin *plugin, char *filename) perl_destruct (perl_current_interpreter); perl_free (perl_current_interpreter); #endif - if (perl_current_script != NULL) + if ((perl_current_script != NULL) && (perl_current_script != &tempscript)) weechat_script_remove (plugin, &perl_scripts, perl_current_script); return 0; diff --git a/weechat/src/plugins/scripts/python/weechat-python.c b/weechat/src/plugins/scripts/python/weechat-python.c index 85be78a40..00728bba5 100644 --- a/weechat/src/plugins/scripts/python/weechat-python.c +++ b/weechat/src/plugins/scripts/python/weechat-python.c @@ -78,8 +78,6 @@ weechat_python_exec (t_weechat_plugin *plugin, rc = PyObject_CallFunction(evFunc, "ss", server == NULL ? "" : server, arguments == NULL ? "" : arguments); - python_current_script = NULL; - if (rc) { ret = (int) PyInt_AsLong(rc); diff --git a/weechat/src/plugins/scripts/ruby/weechat-ruby.c b/weechat/src/plugins/scripts/ruby/weechat-ruby.c index a850c0ff0..29c51e215 100644 --- a/weechat/src/plugins/scripts/ruby/weechat-ruby.c +++ b/weechat/src/plugins/scripts/ruby/weechat-ruby.c @@ -126,8 +126,6 @@ weechat_ruby_exec (t_weechat_plugin *plugin, &ruby_error, 2, rb_str_new2((server == NULL) ? "" : server), rb_str_new2((arguments == NULL) ? "" : arguments)); - ruby_current_script = NULL; - if (ruby_error) { VALUE ruby_error_info = rb_inspect(ruby_errinfo); @@ -996,6 +994,10 @@ weechat_ruby_load (t_weechat_plugin *plugin, char *filename) filename); ruby_plugin->printf_server (ruby_plugin, "Ruby error: %s", STR2CSTR(ruby_error_info)); + + if (ruby_current_script != NULL) + weechat_script_remove (plugin, &ruby_scripts, ruby_current_script); + return 0; }