From af6760b3c95694f33455a2d542eb9cb817290bde Mon Sep 17 00:00:00 2001 From: Jehan Date: Wed, 20 Mar 2019 14:02:11 +0100 Subject: [PATCH] app: fixes g_object_unref: assertion 'G_IS_OBJECT (object)' failed. "binding" data can be set to NULL. Do not assume it is a proper object. Also I was tempted to use g_object_set_data() to simply free the GBinding object on setting a new data, but such object will also be freed when the widget is destroyed by default. So that would also end up in double destruction. Instead just keep current logics. This CRITICAL was reported in #3133 but this is not the main bug. --- app/propgui/gimppropgui-generic.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/app/propgui/gimppropgui-generic.c b/app/propgui/gimppropgui-generic.c index 020c5e260b..eb40635d33 100644 --- a/app/propgui/gimppropgui-generic.c +++ b/app/propgui/gimppropgui-generic.c @@ -276,27 +276,21 @@ static void gimp_prop_gui_chain_toggled (GimpChainButton *chain, GtkAdjustment *x_adj) { + GBinding *binding; GtkAdjustment *y_adj; y_adj = g_object_get_data (G_OBJECT (x_adj), "y-adjustment"); if (gimp_chain_button_get_active (chain)) { - GBinding *binding; - binding = g_object_bind_property (x_adj, "value", y_adj, "value", G_BINDING_BIDIRECTIONAL); - - g_object_set_data (G_OBJECT (chain), "binding", binding); } else { - GBinding *binding; - binding = g_object_get_data (G_OBJECT (chain), "binding"); - - g_object_unref (binding); - g_object_set_data (G_OBJECT (chain), "binding", NULL); + g_clear_object (&binding); } + g_object_set_data (G_OBJECT (chain), "binding", binding); }