[gnome-builder] gstyle-eyedropper: better lifetime handling
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] gstyle-eyedropper: better lifetime handling
- Date: Mon, 18 Jul 2016 00:22:18 +0000 (UTC)
commit 13ee22afd0cc2d95b621c210191de21a5bf0d18e
Author: Sebastien Lafargue <slafargue gnome org>
Date: Sun Jul 17 11:35:09 2016 +0200
gstyle-eyedropper: better lifetime handling
contrib/gstyle/gstyle-color-panel.c | 30 ++++++++++++++++--------------
1 files changed, 16 insertions(+), 14 deletions(-)
---
diff --git a/contrib/gstyle/gstyle-color-panel.c b/contrib/gstyle/gstyle-color-panel.c
index 7832d41..3cc044c 100644
--- a/contrib/gstyle/gstyle-color-panel.c
+++ b/contrib/gstyle/gstyle-color-panel.c
@@ -485,8 +485,7 @@ grab_released_cb (GstyleColorPanel *self)
{
g_assert (GSTYLE_IS_COLOR_PANEL (self));
- /* FIX: release the eyedropper here cause a Segfault */
- //g_clear_object (&self->eyedropper);
+ g_clear_object (&self->eyedropper);
}
static void
@@ -501,20 +500,22 @@ picker_button_clicked_cb (GstyleColorPanel *self,
event = gtk_get_current_event ();
g_assert (event != NULL);
- self->eyedropper = g_object_new (GSTYLE_TYPE_EYEDROPPER,
- "source-event", event,
- NULL);
+ self->eyedropper = g_object_ref_sink (g_object_new (GSTYLE_TYPE_EYEDROPPER,
+ "source-event", event,
+ NULL));
gdk_event_free (event);
- g_signal_connect_swapped (self->eyedropper,
- "color-picked",
- G_CALLBACK (color_picked_cb),
- self);
-
- g_signal_connect_swapped (self->eyedropper,
- "grab-released",
- G_CALLBACK (grab_released_cb),
- self);
+ g_signal_connect_object (self->eyedropper,
+ "color-picked",
+ G_CALLBACK (color_picked_cb),
+ self,
+ G_CONNECT_SWAPPED);
+
+ g_signal_connect_object (self->eyedropper,
+ "grab-released",
+ G_CALLBACK (grab_released_cb),
+ self,
+ G_CONNECT_SWAPPED);
}
static void
@@ -1125,6 +1126,7 @@ gstyle_color_panel_dispose (GObject *object)
g_clear_object (&self->default_provider);
g_clear_object (&self->degree_icon);
g_clear_object (&self->percent_icon);
+ g_clear_object (&self->eyedropper);
gstyle_color_panel_set_prefs_pages (self, NULL, NULL, NULL, NULL);
G_OBJECT_CLASS (gstyle_color_panel_parent_class)->dispose (object);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]