From 2d4f6eb2b8e1c0dbe614c42efd1f2d2541e3b0c2 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Tue, 21 Jun 2016 12:39:53 -0400 Subject: [PATCH] Stop uiProgressBar pulsing on destroy on GTK+. Fixes #163. --- uitable.h | 2 +- unix/progressbar.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/uitable.h b/uitable.h index 645096bd..a9008369 100644 --- a/uitable.h +++ b/uitable.h @@ -29,7 +29,7 @@ typedef struct uiTableCellPart uiTableCellPart; _UI_EXTERN uiTableCellLayout *uiNewTableCellLayout(void); _UI_EXTERN void uiFreeTableCellLayout(uiTableCellLayout *c); -_UI_ExTERN void uiTableCellLayoutAppend(uiTableCellLayout *c, uiTableCellPart *part, int expand); +_UI_EXTERN void uiTableCellLayoutAppend(uiTableCellLayout *c, uiTableCellPart *part, int expand); _UI_EXTERN uiTableCellPart *uiNewTableTextPart(int modelColumn); _UI_EXTERN void uiFreeTableCellPart(uiTableCellPart *p); diff --git a/unix/progressbar.c b/unix/progressbar.c index 08b45f33..9b543b04 100644 --- a/unix/progressbar.c +++ b/unix/progressbar.c @@ -9,7 +9,18 @@ struct uiProgressBar { guint pulser; }; -uiUnixControlAllDefaults(uiProgressBar) +uiUnixControlAllDefaultsExceptDestroy(uiProgressBar) + +static void uiProgressBarDestroy(uiControl *c) +{ + uiProgressBar *p = uiProgressBar(c); + + // be sure to stop the timeout now + if (p->indeterminate) + g_source_remove(p->pulser); + g_object_unref(p->widget); + uiFreeControl(uiControl(p)); +} int uiProgressBarValue(uiProgressBar *p) {