diff options
| author | Pietro Gagliardi <[email protected]> | 2015-04-08 01:16:22 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2015-04-08 01:16:22 -0400 |
| commit | d37bc67158228e75dc4f47cf445c771a890fb35a (patch) | |
| tree | 34d3dc791b7eb46eb1658b22c630105792ee8af1 /new/button_unix.c | |
| parent | f5c8bdd4b3fb089370f3cc41a742b3385289efe1 (diff) | |
Cleaned up memory leaks in the GTK+ backend.
Diffstat (limited to 'new/button_unix.c')
| -rw-r--r-- | new/button_unix.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/new/button_unix.c b/new/button_unix.c index 986e81d..8ab9aa6 100644 --- a/new/button_unix.c +++ b/new/button_unix.c @@ -19,7 +19,13 @@ static void defaultOnClicked(uiControl *c, void *data) // do nothing } -// TODO destruction +static void onDestroy(GtkWidget *widget, gpointer data) +{ + struct button *b = (struct button *) data; + + uiFree(b); +} + uiControl *uiNewButton(const char *text) { struct button *b; @@ -33,6 +39,7 @@ uiControl *uiNewButton(const char *text) NULL); widget = GTK_WIDGET(uiControlHandle(b->c)); + g_signal_connect(widget, "destroy", G_CALLBACK(onDestroy), b); g_signal_connect(widget, "clicked", G_CALLBACK(onClicked), b); b->onClicked = defaultOnClicked; |
