From 9042e85f3c4b000a3f1f43ad09c1f97e6418c999 Mon Sep 17 00:00:00 2001 From: Jehan Date: Wed, 20 Mar 2019 15:05:22 +0100 Subject: [PATCH] app: make gimp_prop_gui_chain_toggled() less error-prone. Don't assume that "toggled" signal means that toggle status actually changed. Though issue #3133 got fixed with my previous commit, let's make sure we never create several GBinding for the same GimpChain by always checking existence of a previous one after a "toggled" signal. Also only create a GBinding object if one doesn't already exist. --- app/propgui/gimppropgui-generic.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/propgui/gimppropgui-generic.c b/app/propgui/gimppropgui-generic.c index eb40635d33..43529bff1a 100644 --- a/app/propgui/gimppropgui-generic.c +++ b/app/propgui/gimppropgui-generic.c @@ -279,17 +279,18 @@ gimp_prop_gui_chain_toggled (GimpChainButton *chain, GBinding *binding; GtkAdjustment *y_adj; - y_adj = g_object_get_data (G_OBJECT (x_adj), "y-adjustment"); + binding = g_object_get_data (G_OBJECT (chain), "binding"); + y_adj = g_object_get_data (G_OBJECT (x_adj), "y-adjustment"); if (gimp_chain_button_get_active (chain)) { - binding = g_object_bind_property (x_adj, "value", - y_adj, "value", - G_BINDING_BIDIRECTIONAL); + if (! binding) + binding = g_object_bind_property (x_adj, "value", + y_adj, "value", + G_BINDING_BIDIRECTIONAL); } else { - binding = g_object_get_data (G_OBJECT (chain), "binding"); g_clear_object (&binding); } g_object_set_data (G_OBJECT (chain), "binding", binding);