[gnome-builder/wip/plugins] ctags: protect against context finalization
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/plugins] ctags: protect against context finalization
- Date: Tue, 9 Jun 2015 22:31:11 +0000 (UTC)
commit c6509b9acc2f11fbd8847f81bc44f65008d48fde
Author: Christian Hergert <christian hergert me>
Date: Tue Jun 9 15:31:02 2015 -0700
ctags: protect against context finalization
I've seen occasionally, when typing a bit too quickly perhaps, the
context getting destroyed while the treeview is still rendering.
libide/ctags/ide-ctags-completion-item.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/libide/ctags/ide-ctags-completion-item.c b/libide/ctags/ide-ctags-completion-item.c
index 8077a2c..00e8621 100644
--- a/libide/ctags/ide-ctags-completion-item.c
+++ b/libide/ctags/ide-ctags-completion-item.c
@@ -57,7 +57,12 @@ ide_ctags_completion_item_new (const IdeCtagsIndexEntry *entry,
*/
self->entry = entry;
self->provider = provider;
- self->context = context;
+
+ /*
+ * There is the slight chance the context will get disposed out of
+ * our control. I've seen this happen a few times now.
+ */
+ ide_set_weak_pointer (&self->context, context);
return GTK_SOURCE_COMPLETION_PROPOSAL (self);
}
@@ -72,6 +77,10 @@ ide_ctags_completion_item_compare (IdeCtagsCompletionItem *itema,
static void
ide_ctags_completion_item_finalize (GObject *object)
{
+ IdeCtagsCompletionItem *self = (IdeCtagsCompletionItem *)object;
+
+ ide_clear_weak_pointer (&self->context);
+
G_OBJECT_CLASS (ide_ctags_completion_item_parent_class)->finalize (object);
EGG_COUNTER_DEC (instances);
@@ -112,6 +121,9 @@ get_icon (GtkSourceCompletionProposal *proposal)
{
IdeCtagsCompletionItem *self = (IdeCtagsCompletionItem *)proposal;
+ if (self->context == NULL)
+ return NULL;
+
return ide_ctags_completion_provider_get_proposal_icon (self->provider,
self->context,
self->entry);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]