Fixed the faults: upon further examination, the garbage collector was eating the callback closures!

This commit is contained in:
Pietro Gagliardi 2014-02-18 14:22:31 -05:00
parent 23f6a07c7f
commit 647b69a3bb
1 changed files with 4 additions and 0 deletions

View File

@ -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))