[gimp/gimp-attributes-wip] libgimpbase: fix removing attribute
- From: Hartmut Kuhse <hartmutkuhse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-attributes-wip] libgimpbase: fix removing attribute
- Date: Tue, 7 Oct 2014 17:33:14 +0000 (UTC)
commit 0d428b5b38d9342c6c30768bbf5448d22b451450
Author: Hartmut Kuhse <hk_priv gmx de>
Date: Tue Oct 7 19:30:40 2014 +0200
libgimpbase: fix removing attribute
libgimpbase/gimpattribute.c | 1 +
libgimpbase/gimpattributes.c | 30 ++++++++++++++++++++++--------
2 files changed, 23 insertions(+), 8 deletions(-)
---
diff --git a/libgimpbase/gimpattribute.c b/libgimpbase/gimpattribute.c
index c8169ac..16d3bb0 100644
--- a/libgimpbase/gimpattribute.c
+++ b/libgimpbase/gimpattribute.c
@@ -1440,6 +1440,7 @@ gimp_attribute_finalize (GObject* obj)
g_slist_free_full (private->attribute_structure, g_free);
G_OBJECT_CLASS (gimp_attribute_parent_class)->finalize (obj);
+ obj = NULL;
}
/**
diff --git a/libgimpbase/gimpattributes.c b/libgimpbase/gimpattributes.c
index c9ebae8..7fa7908 100644
--- a/libgimpbase/gimpattributes.c
+++ b/libgimpbase/gimpattributes.c
@@ -453,12 +453,15 @@ gimp_attributes_get_attribute_sorted (GimpAttributes *attributes,
data = g_hash_table_lookup (attributes->priv->sorted_to_attribute, (gpointer) lowchar);
- name_of_tag = (gchar *) data;
-
- data = g_hash_table_lookup (attributes->priv->attribute_table, (gpointer) name_of_tag);
if (data)
{
- attribute_data = (GimpAttribute *) data;
+ name_of_tag = (gchar *) data;
+
+ data = g_hash_table_lookup (attributes->priv->attribute_table, (gpointer) name_of_tag);
+ if (data)
+ {
+ attribute_data = (GimpAttribute *) data;
+ }
}
g_free (lowchar);
@@ -509,8 +512,21 @@ gimp_attributes_remove_attribute (GimpAttributes *attributes,
if (g_hash_table_remove (attributes->priv->sorted_to_attribute, (gpointer) tag_to_remove))
{
- attributes->priv->sorted_key_list = g_list_remove (attributes->priv->sorted_key_list,
- (gconstpointer) tag_list_remove);
+ GList *list = NULL;
+
+ for (list = attributes->priv->sorted_key_list; list; list = list->next)
+ {
+ gchar *s_tag = (gchar *) list->data;
+
+ if (! g_strcmp0 (s_tag, tag_list_remove))
+ {
+ attributes->priv->sorted_key_list = g_list_remove (attributes->priv->sorted_key_list,
+ (gconstpointer) s_tag);
+ g_free (s_tag);
+ break;
+ }
+ }
+ g_free (tag_list_remove);
success = TRUE;
}
else
@@ -521,8 +537,6 @@ gimp_attributes_remove_attribute (GimpAttributes *attributes,
g_free (tag_to_remove);
success = FALSE;
}
-
- g_free (tag_list_remove);
}
g_free (lowchar);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]