]> jfr.im git - irc/weechat/weechat.git/commitdiff
guile: fix crash on quit with Guile < 3 (closes #1965)
authorSébastien Helleu <redacted>
Tue, 27 Jun 2023 19:44:54 +0000 (21:44 +0200)
committerSébastien Helleu <redacted>
Tue, 27 Jun 2023 19:44:54 +0000 (21:44 +0200)
ChangeLog.adoc
src/plugins/guile/weechat-guile.c

index 4ab151ebfd376c34493e4894433890622ab0ba6f..e7506d254a5443f712da790e04b5848477571c64 100644 (file)
@@ -19,6 +19,7 @@ Bug fixes::
   * core: display actual key name and command with key kbd:[Alt+k], remove key kbd:[Alt+K] (grab raw key) and associated commands `/input grab_raw_key` and `/input grab_raw_key_command`
   * core: check for newline characters in string_is_whitespace_char (issue #1968)
   * api: do not convert option name to lower case in API functions config_set_plugin and config_set_desc_plugin
+  * guile: fix crash on quit with Guile < 3 (issue #1965)
   * irc: reply to a CTCP request sent to self nick (issue #1966)
   * irc: sent "QUIT" message to servers connected with TLS on `/upgrade`
 
index b7b05d456d057daa2de88c2cfb452425f1201247..ce9cd4d87d4c56b908dc223acf9e6d5ec1de10c9 100644 (file)
@@ -1289,7 +1289,16 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
     scm_install_gmp_memory_functions = 0;
 #endif /* defined(HAVE_GUILE_GMP_MEMORY_FUNCTIONS) && (SCM_MAJOR_VERSION < 3 || (SCM_MAJOR_VERSION == 3 && SCM_MINOR_VERSION == 0 && SCM_MICRO_VERSION < 8)) */
 
+#if defined(__MACH__) || SCM_MAJOR_VERSION < 3
+    /*
+     * on GNU/Hurd or if using Guile < 3, use scm_with_guile() instead of
+     * scm_init_guile() to prevent crash on exit
+     */
     scm_with_guile (&weechat_guile_init, NULL);
+#else
+    /* any other OS (not GNU/Hurd) or Guile >= 3.x */
+    scm_init_guile ();
+#endif
 
     guile_module_weechat = scm_c_define_module ("weechat",
                                                 &weechat_guile_api_module_init,