From 58918e2eeb6cbb1ac91ed2609a09f6581dd0f646 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sun, 10 Jun 2012 22:31:29 +0200 Subject: [PATCH] guile: fix crash when unloading a script without pointer to interpreter --- ChangeLog | 1 + src/plugins/scripts/guile/weechat-guile.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 66c5e763b..fa46e9600 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,7 @@ Version 0.3.9 (under dev!) * core: reallow names beginning with "#" for bars, proxies and filters * core: escape special chars (`#[\`) in configuration files for name of options (bug #36584) +* guile: fix crash when unloading a script without pointer to interpreter * guile: fix path of guile include dirs in cmake build (patch #7790) * irc: fix freeze when reading on socket with SSL enabled (bug #35097) * irc: reallow names beginning with "#" for servers diff --git a/src/plugins/scripts/guile/weechat-guile.c b/src/plugins/scripts/guile/weechat-guile.c index 574d30849..aeb974646 100644 --- a/src/plugins/scripts/guile/weechat-guile.c +++ b/src/plugins/scripts/guile/weechat-guile.c @@ -436,6 +436,7 @@ void weechat_guile_unload (struct t_plugin_script *script) { int *rc; + void *interpreter; if ((weechat_guile_plugin->debug >= 2) || !guile_quiet) { @@ -452,7 +453,7 @@ weechat_guile_unload (struct t_plugin_script *script) free (rc); } - weechat_guile_catch (scm_gc_unprotect_object, script->interpreter); + interpreter = script->interpreter; if (guile_current_script == script) guile_current_script = (guile_current_script->prev_script) ? @@ -460,6 +461,9 @@ weechat_guile_unload (struct t_plugin_script *script) script_remove (weechat_guile_plugin, &guile_scripts, &last_guile_script, script); + + if (interpreter) + weechat_guile_catch (scm_gc_unprotect_object, interpreter); } /*