[libdazzle] listbox: be more defensive about cleaning up
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdazzle] listbox: be more defensive about cleaning up
- Date: Wed, 7 Jun 2017 00:58:41 +0000 (UTC)
commit d328aedeaf193bf098b17340a2ae61ba325e9352
Author: Christian Hergert <chergert redhat com>
Date: Tue Jun 6 17:57:59 2017 -0700
listbox: be more defensive about cleaning up
src/widgets/dzl-list-box.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/widgets/dzl-list-box.c b/src/widgets/dzl-list-box.c
index bf6f830..228d121 100644
--- a/src/widgets/dzl-list-box.c
+++ b/src/widgets/dzl-list-box.c
@@ -42,6 +42,7 @@ typedef struct
GType row_type;
guint recycle_max;
GQueue trashed_rows;
+ guint destroying : 1;
} DzlListBoxPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (DzlListBox, dzl_list_box, GTK_TYPE_LIST_BOX)
@@ -157,11 +158,19 @@ dzl_list_box_destroy (GtkWidget *widget)
{
DzlListBox *self = (DzlListBox *)widget;
DzlListBoxPrivate *priv = dzl_list_box_get_instance_private (self);
+ GList *rows;
g_assert (DZL_IS_LIST_BOX (self));
- g_queue_foreach (&priv->trashed_rows, (GFunc)g_object_unref, NULL);
- g_queue_clear (&priv->trashed_rows);
+ priv->destroying = TRUE;
+ priv->recycle_max = 0;
+
+ rows = priv->trashed_rows.head;
+ priv->trashed_rows.tail = NULL;
+ priv->trashed_rows.length = 0;
+
+ g_list_foreach (rows, (GFunc)gtk_widget_destroy, NULL);
+ g_list_free (rows);
GTK_WIDGET_CLASS (dzl_list_box_parent_class)->destroy (widget);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]