From f4f39e9d7471df807d8a8e9a8ee12f56e30e10d6 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 6 Feb 2019 20:37:38 -0800 Subject: Store closures in globals, to protect from GC. --- gtkffi.tl | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/gtkffi.tl b/gtkffi.tl index faad59f..e07c4ee 100644 --- a/gtkffi.tl +++ b/gtkffi.tl @@ -76,10 +76,9 @@ (let ((cb (callbackname abutton))) ^(progn (defparm ,abutton nil) - (defun ,cb (a b) - ,*body) + (defparm ,cb [button-cb (lambda (a b) ,*body)]) (set ,abutton (gtk_button_new_with_label ,buttonlabel)) - (g_signal_connect_data ,abutton "clicked" [button-cb ,cb] + (g_signal_connect_data ,abutton "clicked" ,cb null null 0) (gtk_container_add ,placement ,abutton)))) @@ -116,7 +115,6 @@ (let ((cb (callbackname theapp))) ^(progn (defparm ,theapp nil) - (defun ,cb (a b) - ,*body) + (defparm ,cb [app-cb (lambda (a b) ,*body)]) (set ,theapp (gtk_application_new nil 0)) - (g_signal_connect_data ,theapp "activate" [app-cb ,cb] null null 0)))) + (g_signal_connect_data ,theapp "activate" ,cb null null 0)))) -- cgit v1.2.3