[gnome-builder] gstyle: release cairo surface in destroy
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] gstyle: release cairo surface in destroy
- Date: Tue, 12 Jun 2018 05:00:05 +0000 (UTC)
commit fcbc58534a96483b6972895ceebac523597fb127
Author: Christian Hergert <chergert redhat com>
Date: Mon Jun 11 21:59:27 2018 -0700
gstyle: release cairo surface in destroy
src/gstyle/gstyle-color-plane.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/gstyle/gstyle-color-plane.c b/src/gstyle/gstyle-color-plane.c
index d8a3b236e..2cedf80c1 100644
--- a/src/gstyle/gstyle-color-plane.c
+++ b/src/gstyle/gstyle-color-plane.c
@@ -1344,15 +1344,23 @@ gstyle_color_plane_set_mode (GstyleColorPlane *self,
}
}
+static void
+gstyle_color_plane_destroy (GtkWidget *widget)
+{
+ GstyleColorPlane *self = (GstyleColorPlane *)widget;
+ GstyleColorPlanePrivate *priv = gstyle_color_plane_get_instance_private (self);
+
+ g_clear_pointer (&priv->surface, cairo_surface_destroy);
+
+ GTK_WIDGET_CLASS (gstyle_color_plane_parent_class)->destroy (widget);
+}
+
static void
gstyle_color_plane_finalize (GObject *object)
{
GstyleColorPlane *self = (GstyleColorPlane *)object;
GstyleColorPlanePrivate *priv = gstyle_color_plane_get_instance_private (self);
- if (priv->surface)
- cairo_surface_destroy (priv->surface);
-
g_clear_object (&priv->drag_gesture);
g_clear_object (&priv->long_press_gesture);
g_clear_object (&priv->default_provider);
@@ -1450,6 +1458,7 @@ gstyle_color_plane_class_init (GstyleColorPlaneClass *klass)
widget_class->draw = gstyle_color_plane_draw;
widget_class->size_allocate = gstyle_color_plane_size_allocate;
widget_class->key_press_event = gstyle_color_plane_key_press;
+ widget_class->destroy = gstyle_color_plane_destroy;
properties [PROP_MODE] =
g_param_spec_enum ("mode",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]