From 95d9002e73c779bb1143d1bc3de5e3e7170b0944 Mon Sep 17 00:00:00 2001 From: Anton Gorenko Date: Sun, 13 Jun 2010 16:18:51 +0600 Subject: [PATCH] ui.backend.gtk: add destructor in clipboard-contents --- basis/glib/ffi/ffi.factor | 1 + basis/ui/backend/gtk/gtk.factor | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/basis/glib/ffi/ffi.factor b/basis/glib/ffi/ffi.factor index 51fa3af04c..99183a88dc 100644 --- a/basis/glib/ffi/ffi.factor +++ b/basis/glib/ffi/ffi.factor @@ -72,6 +72,7 @@ IMPLEMENT-STRUCTS: GPollFD GSource GSourceFuncs ; GIR: vocab:glib/GLib-2.0.gir DESTRUCTOR: g_source_unref +DESTRUCTOR: g_free CALLBACK: gboolean GSourceFuncsPrepareFunc ( GSource* source, gint* timeout_ ) ; CALLBACK: gboolean GSourceFuncsCheckFunc ( GSource* source ) ; diff --git a/basis/ui/backend/gtk/gtk.factor b/basis/ui/backend/gtk/gtk.factor index 3a2835c1b1..045a75d075 100644 --- a/basis/ui/backend/gtk/gtk.factor +++ b/basis/ui/backend/gtk/gtk.factor @@ -466,7 +466,10 @@ M:: gtk-ui-backend system-alert ( caption text -- ) [ gtk_widget_destroy ] tri ; M: gtk-clipboard clipboard-contents - handle>> gtk_clipboard_wait_for_text utf8 alien>string ; + [ + handle>> gtk_clipboard_wait_for_text + [ &g_free utf8 alien>string ] [ f ] if* + ] with-destructors ; M: gtk-clipboard set-clipboard-contents swap [ handle>> ] [ utf8 string>alien ] bi*