summaryrefslogtreecommitdiff
path: root/src/plugins/guile/weechat-guile.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2013-02-19 19:49:12 +0100
committerSebastien Helleu <flashcode@flashtux.org>2013-02-19 19:49:12 +0100
commitc43d48a9dff87cd935bde9d545835d5690dcaef6 (patch)
tree9d56d624af64a7d16cbc7056ea2c2ca02e5cd8db /src/plugins/guile/weechat-guile.c
parente4529079a8a5074a869244acc9bbb76152ab2a2f (diff)
downloadweechat-c43d48a9dff87cd935bde9d545835d5690dcaef6.zip
guile: fix crash on calls to callbacks during load of script (bug #38343)
Diffstat (limited to 'src/plugins/guile/weechat-guile.c')
-rw-r--r--src/plugins/guile/weechat-guile.c13
1 files changed, 9 insertions, 4 deletions
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;