[gnome-builder/gnome-builder-3-18] ctags: hold a reference to the index for the lifetime of the results
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/gnome-builder-3-18] ctags: hold a reference to the index for the lifetime of the results
- Date: Tue, 13 Oct 2015 07:41:00 +0000 (UTC)
commit 7147381628f45bbf611b919051b394bf5335a9dd
Author: Christian Hergert <chergert redhat com>
Date: Mon Oct 12 12:36:20 2015 -0400
ctags: hold a reference to the index for the lifetime of the results
We could lose our index when an index is reloaded (because it was changed).
Since we are going to create more tags more often now (using `make ctags`)
this will become even more of an issue. Either way it was a crasher and
needed fixing.
plugins/ctags/ide-ctags-completion-provider.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/plugins/ctags/ide-ctags-completion-provider.c b/plugins/ctags/ide-ctags-completion-provider.c
index b3b9c08..fc6e1e9 100644
--- a/plugins/ctags/ide-ctags-completion-provider.c
+++ b/plugins/ctags/ide-ctags-completion-provider.c
@@ -211,6 +211,15 @@ ide_ctags_completion_provider_populate (GtkSourceCompletionProvider *provider,
const gchar *last_name = NULL;
guint tmp_len = word_len;
gsize n_entries = 0;
+ gchar gdata_key[64];
+
+ /*
+ * Make sure we hold a reference to the index for the lifetime of the results.
+ * When the results are released, so could our indexes.
+ */
+ g_snprintf (gdata_key, sizeof gdata_key, "ctags-%d", i);
+ g_object_set_data_full (G_OBJECT (self->results), gdata_key,
+ g_object_ref (index), g_object_unref);
while (entries == NULL && *copy)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]