From 13b2af4b613c09983814aff53bfa51ead57fc0cd Mon Sep 17 00:00:00 2001 From: Jason Miller Date: Sat, 23 May 2020 14:22:07 +0200 Subject: Prevent scheme functions to be garbage collected --- keys.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/keys.c b/keys.c index a1928f5..f90096c 100644 --- a/keys.c +++ b/keys.c @@ -105,6 +105,9 @@ add_key (KeyType_t type, EventType_t event_type, KeySym keysym, KeyCode keycode, modifier &= ~(numlock_mask | capslock_mask | scrolllock_mask); +#ifdef GUILE_FLAG + if(function) scm_gc_protect_object(function); +#endif /* set key */ if (type == SYM) { @@ -344,6 +347,9 @@ free_key (Keys_t * key) if (key->command != NULL) free (key->command); +#ifdef GUILE_FLAG + if(key->function) scm_gc_unprotect_object(key->function); +#endif key->function = 0; } -- cgit v1.2.3-70-g09d2