[gimp/gimp-2-8] app: block edited signal in GimpDataFactory edited callback
- From: Kristian Rietveld <kristian src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-8] app: block edited signal in GimpDataFactory edited callback
- Date: Fri, 15 Apr 2016 22:46:53 +0000 (UTC)
commit c373981c4046889abb743cb068bc8cce5fb88f1b
Author: Kristian Rietveld <kris loopnest org>
Date: Fri Apr 15 23:25:08 2016 +0100
app: block edited signal in GimpDataFactory edited callback
This fixes a problem where in some cases the item next to the edited
item was changed inadvertently. This was caused by the fact that
the change of the label within the tree_name_edited callback triggered
a re-ordering of the items, which triggered a stop editing signal, which
finally caused a re-entrance in the tree_name_edited callback. By this
time the item below "path_str" has changed, which caused the name of
another object to be edited.
(cherry picked from commit 2213f29677e1a3e1ccee7ca18e8accc288c83d18)
app/widgets/gimpdatafactoryview.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/app/widgets/gimpdatafactoryview.c b/app/widgets/gimpdatafactoryview.c
index 09fb678..fc272f1 100644
--- a/app/widgets/gimpdatafactoryview.c
+++ b/app/widgets/gimpdatafactoryview.c
@@ -525,6 +525,18 @@ gimp_data_factory_view_tree_name_edited (GtkCellRendererText *cell,
name = g_strstrip (g_strdup (new_name));
+ /* We must block the edited callback at this point, because either
+ * the call to gimp_object_take_name() or gtk_tree_store_set() below
+ * will trigger a re-ordering and emission of the rows_reordered signal.
+ * This in turn will stop the editing operation and cause a call to this
+ * very callback function again. Because the order of the rows has
+ * changed by then, "path_str" will point at another item and cause the
+ * name of this item to be changed as well.
+ */
+ g_signal_handlers_block_by_func (cell,
+ gimp_data_factory_view_tree_name_edited,
+ view);
+
if (gimp_data_is_writable (data) && strlen (name))
{
gimp_object_take_name (GIMP_OBJECT (data), name);
@@ -540,6 +552,10 @@ gimp_data_factory_view_tree_name_edited (GtkCellRendererText *cell,
g_free (name);
}
+ g_signal_handlers_unblock_by_func (cell,
+ gimp_data_factory_view_tree_name_edited,
+ view);
+
g_object_unref (renderer);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]