From 647b69a3bb1dcfabd0d5a02fbce5c2e9db079b2a Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Tue, 18 Feb 2014 14:22:31 -0500 Subject: [PATCH] Fixed the faults: upon further examination, the garbage collector was eating the callback closures! --- gtkcalls_unix.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gtkcalls_unix.go b/gtkcalls_unix.go index fc29aab..62802e1 100644 --- a/gtkcalls_unix.go +++ b/gtkcalls_unix.go @@ -37,7 +37,11 @@ func gtk_window_new() *gtkWidget { return fromgtkwidget(C.gtk_window_new(0)) } +// the garbage collector has been found to eat my callback functions; this will stop it +var callbackstore = make([]*func() bool, 0, 50) + func g_signal_connect(obj *gtkWidget, sig string, callback func() bool) { + callbackstore = append(callbackstore, &callback) ccallback := callbacks[sig] csig := C.CString(sig) defer C.free(unsafe.Pointer(csig))