[gtk+] scrolled window: Free gestures and gadgets in finalize
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] scrolled window: Free gestures and gadgets in finalize
- Date: Mon, 6 Jun 2016 00:01:20 +0000 (UTC)
commit b4ebe4e5c1166b38ebb6230fea73873c7ebf5ac9
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Jun 5 19:36:09 2016 -0400
scrolled window: Free gestures and gadgets in finalize
This is the right place for this.
gtk/gtkscrolledwindow.c | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 994ee7b..1ef826b 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -312,6 +312,7 @@ static void gtk_scrolled_window_get_property (GObject *objec
guint prop_id,
GValue *value,
GParamSpec *pspec);
+static void gtk_scrolled_window_finalize (GObject *object);
static void gtk_scrolled_window_destroy (GtkWidget *widget);
static gboolean gtk_scrolled_window_draw (GtkWidget *widget,
@@ -519,6 +520,7 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
gobject_class->set_property = gtk_scrolled_window_set_property;
gobject_class->get_property = gtk_scrolled_window_get_property;
+ gobject_class->finalize = gtk_scrolled_window_finalize;
widget_class->destroy = gtk_scrolled_window_destroy;
widget_class->draw = gtk_scrolled_window_draw;
@@ -1792,7 +1794,8 @@ gtk_scrolled_window_measure (GtkCssGadget *gadget,
natural_req.width += priv->min_content_width;
extra_width = -1;
}
- else if (policy_may_be_visible (priv->vscrollbar_policy) && !priv->use_indicators)
+
+ if (policy_may_be_visible (priv->vscrollbar_policy) && !priv->use_indicators)
{
minimum_req.width += vscrollbar_requisition.width;
natural_req.width += vscrollbar_requisition.width;
@@ -1832,7 +1835,8 @@ gtk_scrolled_window_measure (GtkCssGadget *gadget,
natural_req.height += priv->min_content_height;
extra_height = -1;
}
- else if (policy_may_be_visible (priv->hscrollbar_policy) && !priv->use_indicators)
+
+ if (policy_may_be_visible (priv->hscrollbar_policy) && !priv->use_indicators)
{
minimum_req.height += hscrollbar_requisition.height;
natural_req.height += hscrollbar_requisition.height;
@@ -2776,13 +2780,22 @@ gtk_scrolled_window_destroy (GtkWidget *widget)
priv->scroll_events_overshoot_id = 0;
}
+ GTK_WIDGET_CLASS (gtk_scrolled_window_parent_class)->destroy (widget);
+}
+
+static void
+gtk_scrolled_window_finalize (GObject *object)
+{
+ GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (object);
+ GtkScrolledWindowPrivate *priv = scrolled_window->priv;
+
g_clear_object (&priv->drag_gesture);
g_clear_object (&priv->swipe_gesture);
g_clear_object (&priv->long_press_gesture);
g_clear_object (&priv->gadget);
g_clear_pointer (&priv->scroll_history, (GDestroyNotify) g_array_unref);
- GTK_WIDGET_CLASS (gtk_scrolled_window_parent_class)->destroy (widget);
+ G_OBJECT_CLASS (gtk_scrolled_window_parent_class)->finalize (object);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]