summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2009-02-19 17:44:41 +0100
committerSebastien Helleu <flashcode@flashtux.org>2009-02-19 17:44:41 +0100
commite7589e732bfda17608428fd6b1c0cfa4f8ee3150 (patch)
treec219e1a5203c9dc69da883f937d170b5819936ad
parent78fe938e4f4c18eeac64b50b9858aec40e7f85b2 (diff)
downloadweechat-e7589e732bfda17608428fd6b1c0cfa4f8ee3150.zip
Fix bug with current script pointer when current script is unloaded
-rw-r--r--src/plugins/scripts/lua/weechat-lua.c4
-rw-r--r--src/plugins/scripts/perl/weechat-perl.c4
-rw-r--r--src/plugins/scripts/python/weechat-python.c4
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby.c4
-rw-r--r--src/plugins/scripts/tcl/weechat-tcl.c4
5 files changed, 20 insertions, 0 deletions
diff --git a/src/plugins/scripts/lua/weechat-lua.c b/src/plugins/scripts/lua/weechat-lua.c
index c1f7dbfc8..9ac4f81ae 100644
--- a/src/plugins/scripts/lua/weechat-lua.c
+++ b/src/plugins/scripts/lua/weechat-lua.c
@@ -294,6 +294,10 @@ weechat_lua_unload (struct t_plugin_script *script)
interpreter = script->interpreter;
+ if (lua_current_script == script)
+ lua_current_script = (lua_current_script->prev_script) ?
+ lua_current_script->prev_script : lua_current_script->next_script;
+
script_remove (weechat_lua_plugin, &lua_scripts, script);
lua_close (script->interpreter);
diff --git a/src/plugins/scripts/perl/weechat-perl.c b/src/plugins/scripts/perl/weechat-perl.c
index 0e7d33fd9..df97e925e 100644
--- a/src/plugins/scripts/perl/weechat-perl.c
+++ b/src/plugins/scripts/perl/weechat-perl.c
@@ -432,6 +432,10 @@ weechat_perl_unload (struct t_plugin_script *script)
interpreter = script->interpreter;
+ if (perl_current_script == script)
+ perl_current_script = (perl_current_script->prev_script) ?
+ perl_current_script->prev_script : perl_current_script->next_script;
+
script_remove (weechat_perl_plugin, &perl_scripts, script);
#ifdef MULTIPLICITY
diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c
index f923d5cbf..07f4d49b8 100644
--- a/src/plugins/scripts/python/weechat-python.c
+++ b/src/plugins/scripts/python/weechat-python.c
@@ -505,6 +505,10 @@ weechat_python_unload (struct t_plugin_script *script)
interpreter = script->interpreter;
+ if (python_current_script == script)
+ python_current_script = (python_current_script->prev_script) ?
+ python_current_script->prev_script : python_current_script->next_script;
+
script_remove (weechat_python_plugin, &python_scripts, script);
PyThreadState_Swap (interpreter);
diff --git a/src/plugins/scripts/ruby/weechat-ruby.c b/src/plugins/scripts/ruby/weechat-ruby.c
index 34866f545..481679a32 100644
--- a/src/plugins/scripts/ruby/weechat-ruby.c
+++ b/src/plugins/scripts/ruby/weechat-ruby.c
@@ -491,6 +491,10 @@ weechat_ruby_unload (struct t_plugin_script *script)
interpreter = script->interpreter;
+ if (ruby_current_script == script)
+ ruby_current_script = (ruby_current_script->prev_script) ?
+ ruby_current_script->prev_script : ruby_current_script->next_script;
+
script_remove (weechat_ruby_plugin, &ruby_scripts, script);
if (interpreter)
diff --git a/src/plugins/scripts/tcl/weechat-tcl.c b/src/plugins/scripts/tcl/weechat-tcl.c
index 3b7070613..f56ee803a 100644
--- a/src/plugins/scripts/tcl/weechat-tcl.c
+++ b/src/plugins/scripts/tcl/weechat-tcl.c
@@ -235,6 +235,10 @@ weechat_tcl_unload (struct t_plugin_script *script)
interp = (Tcl_Interp*)script->interpreter;
+ if (tcl_current_script == script)
+ tcl_current_script = (tcl_current_script->prev_script) ?
+ tcl_current_script->prev_script : tcl_current_script->next_script;
+
script_remove (weechat_tcl_plugin, &tcl_scripts, script);
Tcl_DeleteInterp(interp);