[gimp] app: fix possible GimpTagEntry crash by keeping the query idle ID around
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: fix possible GimpTagEntry crash by keeping the query idle ID around
- Date: Thu, 24 Mar 2011 08:57:29 +0000 (UTC)
commit 7eda388fec73c963aad97dbfe71c869c36130635
Author: Michael Natterer <mitch gimp org>
Date: Thu Mar 24 09:55:32 2011 +0100
app: fix possible GimpTagEntry crash by keeping the query idle ID around
Remove it in gimp_tag_query_dispose().
app/widgets/gimptagentry.c | 30 ++++++++++++++++--------------
app/widgets/gimptagentry.h | 2 +-
2 files changed, 17 insertions(+), 15 deletions(-)
---
diff --git a/app/widgets/gimptagentry.c b/app/widgets/gimptagentry.c
index 7b88bd1..6c7e879 100644
--- a/app/widgets/gimptagentry.c
+++ b/app/widgets/gimptagentry.c
@@ -250,6 +250,12 @@ gimp_tag_entry_dispose (GObject *object)
entry->mask = NULL;
}
+ if (entry->tag_query_idle_id)
+ {
+ g_source_remove (entry->tag_query_idle_id);
+ entry->tag_query_idle_id = 0;
+ }
+
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@@ -423,12 +429,12 @@ gimp_tag_entry_changed (GtkEntry *entry)
g_free (text);
- if (tag_entry->mode == GIMP_TAG_ENTRY_MODE_QUERY
- && ! tag_entry->suppress_tag_query
- && ! tag_entry->tag_query_pending)
+ if (tag_entry->mode == GIMP_TAG_ENTRY_MODE_QUERY &&
+ ! tag_entry->suppress_tag_query &&
+ ! tag_entry->tag_query_idle_id)
{
- tag_entry->tag_query_pending = TRUE;
- g_idle_add ((GSourceFunc) gimp_tag_entry_query_tag, entry);
+ tag_entry->tag_query_idle_id =
+ g_idle_add ((GSourceFunc) gimp_tag_entry_query_tag, entry);
}
}
@@ -591,12 +597,10 @@ gimp_tag_entry_query_tag (GimpTagEntry *entry)
GList *query_list = NULL;
gboolean has_invalid_tags;
- if (entry->suppress_tag_query)
- {
- entry->tag_query_pending = FALSE;
+ entry->tag_query_idle_id = 0;
- return FALSE;
- }
+ if (entry->suppress_tag_query)
+ return FALSE;
has_invalid_tags = FALSE;
@@ -625,8 +629,6 @@ gimp_tag_entry_query_tag (GimpTagEntry *entry)
gtk_widget_queue_draw (GTK_WIDGET (entry));
}
- entry->tag_query_pending = FALSE;
-
return FALSE;
}
@@ -648,8 +650,8 @@ gimp_tag_entry_auto_complete (GimpTagEntry *tag_entry)
/* tag query was suppressed until we got to auto completion (here),
* now queue tag query
*/
- tag_entry->tag_query_pending = TRUE;
- g_idle_add ((GSourceFunc) gimp_tag_entry_query_tag, tag_entry);
+ tag_entry->tag_query_idle_id =
+ g_idle_add ((GSourceFunc) gimp_tag_entry_query_tag, tag_entry);
}
if (tag_entry->tab_completion_index >= 0)
diff --git a/app/widgets/gimptagentry.h b/app/widgets/gimptagentry.h
index 86e18af..684f9e0 100644
--- a/app/widgets/gimptagentry.h
+++ b/app/widgets/gimptagentry.h
@@ -60,7 +60,7 @@ struct _GimpTagEntry
GimpTagEntryMode mode;
gboolean description_shown;
gboolean has_invalid_tags;
- gboolean tag_query_pending;
+ guint tag_query_idle_id;
};
struct _GimpTagEntryClass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]