[anjuta] language-support-cpp-java: Hold a ref until async queries are finished (bgo#610397)
- From: Johannes Schmid <jhs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] language-support-cpp-java: Hold a ref until async queries are finished (bgo#610397)
- Date: Fri, 19 Feb 2010 10:08:17 +0000 (UTC)
commit faf8dd255f62f42670c18a1e9b2b391df681a9b9
Author: Johannes Schmid <jhs gnome org>
Date: Fri Feb 19 11:08:04 2010 +0100
language-support-cpp-java: Hold a ref until async queries are finished (bgo#610397)
.../language-support-cpp-java/cpp-java-assist.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/plugins/language-support-cpp-java/cpp-java-assist.c b/plugins/language-support-cpp-java/cpp-java-assist.c
index 41f4634..b047f35 100644
--- a/plugins/language-support-cpp-java/cpp-java-assist.c
+++ b/plugins/language-support-cpp-java/cpp-java-assist.c
@@ -194,25 +194,37 @@ on_query_data (gint search_id, IAnjutaIterable* iter, CppJavaAssist* assist)
assist->priv->completion_cache = create_completion (assist,
iter,
assist->priv->completion_cache);
- cpp_java_assist_update_autocomplete(assist);
+ cpp_java_assist_update_autocomplete(assist);
+}
+
+static void
+unref_if_queries_finished (CppJavaAssist* assist)
+{
+ if (!(assist->priv->async_file || assist->priv->async_project || assist->priv->async_system))
+ {
+ g_object_unref (assist);
+ }
}
static void
system_finished (AnjutaAsyncNotify* notify, CppJavaAssist* assist)
{
assist->priv->async_system = FALSE;
+ unref_if_queries_finished (assist);
}
static void
file_finished (AnjutaAsyncNotify* notify, CppJavaAssist* assist)
{
assist->priv->async_file = FALSE;
+ unref_if_queries_finished (assist);
}
static void
project_finished (AnjutaAsyncNotify* notify, CppJavaAssist* assist)
{
assist->priv->async_project = FALSE;
+ unref_if_queries_finished (assist);
}
#define SCOPE_BRACE_JUMP_LIMIT 50
@@ -493,6 +505,8 @@ cpp_java_assist_create_word_completion_cache (CppJavaAssist *assist)
g_free (pattern);
g_free (assist->priv->search_cache);
assist->priv->search_cache = g_strdup (assist->priv->pre_word);
+ // Take a reference on CppJavaAssist until queries finish
+ g_object_ref (assist);
DEBUG_PRINT ("Started async search for: %s", assist->priv->pre_word);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]