From c43d48a9dff87cd935bde9d545835d5690dcaef6 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Tue, 19 Feb 2013 19:49:12 +0100 Subject: [PATCH] guile: fix crash on calls to callbacks during load of script (bug #38343) --- ChangeLog | 3 ++- src/plugins/guile/weechat-guile.c | 13 +++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 98da3ad5f..6a46887e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,7 @@ WeeChat ChangeLog ================= Sébastien Helleu -v0.4.1-dev, 2013-02-18 +v0.4.1-dev, 2013-02-19 Version 0.4.1 (under dev!) @@ -22,6 +22,7 @@ Version 0.4.1 (under dev!) * aspell: add completion "aspell_dicts" (list of aspell installed dictionaries) * aspell: add info "aspell_dict" (dictionaries used on a buffer) * aspell: optimization on spellers to improve speed (save state by buffer) +* guile: fix crash on calls to callbacks during load of script (bug #38343) * guile: fix compilation with guile 2.0 * irc: fix display of malformed CTCP (without closing char) (bug #38347) * irc: unmask smart filtered join if nick speaks in channel some minutes after diff --git a/src/plugins/guile/weechat-guile.c b/src/plugins/guile/weechat-guile.c index 77c744e92..7b5abf3a2 100644 --- a/src/plugins/guile/weechat-guile.c +++ b/src/plugins/guile/weechat-guile.c @@ -255,12 +255,17 @@ weechat_guile_exec (struct t_plugin_script *script, char *format, void **argv) { struct t_plugin_script *old_guile_current_script; - SCM argv_list, rc; + SCM argv_list, rc, old_current_module; void *argv2[17], *ret_value; int i, argc, *ret_int; old_guile_current_script = guile_current_script; - scm_set_current_module ((SCM)(script->interpreter)); + old_current_module = NULL; + if (script->interpreter) + { + old_current_module = scm_current_module (); + scm_set_current_module ((SCM)(script->interpreter)); + } guile_current_script = script; if (argv && argv[0]) @@ -336,8 +341,8 @@ weechat_guile_exec (struct t_plugin_script *script, weechat_prefix ("error"), GUILE_PLUGIN_NAME, function); } - if (old_guile_current_script) - scm_set_current_module ((SCM)(old_guile_current_script->interpreter)); + if (old_current_module) + scm_set_current_module (old_current_module); guile_current_script = old_guile_current_script;