summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-03-07 09:10:14 -0500
committerPietro Gagliardi <[email protected]>2014-03-07 09:10:14 -0500
commit61726d5cddd0801e5eadde5de249fabb19a37b24 (patch)
treea8edeaf12806639660b3edd3040f2e9902f55804
parentded390adb9d8d774db02d424f861466612c8680f (diff)
Oops, the garbage collector is collecting our GTK+ idle callback too (much later than it did the other callbacks). Fixed.
-rw-r--r--gtkcalls_unix.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/gtkcalls_unix.go b/gtkcalls_unix.go
index 5dd6f25..6d9706d 100644
--- a/gtkcalls_unix.go
+++ b/gtkcalls_unix.go
@@ -24,7 +24,11 @@ func gtk_init() bool {
return fromgbool(C.gtk_init_check((*C.int)(nil), (***C.char)(nil)))
}
+// the garbage collector has been found to eat my callback functions; this will stop it
+var callbackstore = make([]*func() bool, 0, 50)
+
func gdk_threads_add_idle(what func() bool) {
+ callbackstore = append(callbackstore, &what)
C.gdk_threads_add_idle(callbacks["idle"], C.gpointer(unsafe.Pointer(&what)))
}
@@ -41,9 +45,6 @@ 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]