[gimp] Bug 767178 - Segment fault on deleting an automatic folder tag
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 767178 - Segment fault on deleting an automatic folder tag
- Date: Tue, 27 Sep 2016 08:18:47 +0000 (UTC)
commit 81603eaa585b1e79544e67339068844a36e29b67
Author: Michael Natterer <mitch gimp org>
Date: Tue Sep 27 10:14:45 2016 +0200
Bug 767178 - Segment fault on deleting an automatic folder tag
The GimpTaggedContainer->tag_ref_counts keeps pointers to GimpTags but
didn't ref them. Ref the tags while they are in the hash table.
app/core/gimptaggedcontainer.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/app/core/gimptaggedcontainer.c b/app/core/gimptaggedcontainer.c
index 3714203..56f6d1a 100644
--- a/app/core/gimptaggedcontainer.c
+++ b/app/core/gimptaggedcontainer.c
@@ -112,8 +112,10 @@ static void
gimp_tagged_container_init (GimpTaggedContainer *tagged_container)
{
tagged_container->tag_ref_counts =
- g_hash_table_new ((GHashFunc) gimp_tag_get_hash,
- (GEqualFunc) gimp_tag_equals);
+ g_hash_table_new_full ((GHashFunc) gimp_tag_get_hash,
+ (GEqualFunc) gimp_tag_equals,
+ (GDestroyNotify) g_object_unref,
+ (GDestroyNotify) NULL);
}
static void
@@ -418,7 +420,9 @@ gimp_tagged_container_ref_tag (GimpTaggedContainer *tagged_container,
tag));
ref_count++;
g_hash_table_insert (tagged_container->tag_ref_counts,
- tag, GINT_TO_POINTER (ref_count));
+ g_object_ref (tag),
+ GINT_TO_POINTER (ref_count));
+
if (ref_count == 1)
{
tagged_container->tag_count++;
@@ -441,7 +445,8 @@ gimp_tagged_container_unref_tag (GimpTaggedContainer *tagged_container,
if (ref_count > 0)
{
g_hash_table_insert (tagged_container->tag_ref_counts,
- tag, GINT_TO_POINTER (ref_count));
+ g_object_ref (tag),
+ GINT_TO_POINTER (ref_count));
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]