[gnome-builder] search: add runtime warnings for invalid thread access
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] search: add runtime warnings for invalid thread access
- Date: Fri, 26 Aug 2016 19:39:07 +0000 (UTC)
commit c92fd728b9f7cdf2f9574b1afddc4a4228499a2e
Author: Christian Hergert <chergert redhat com>
Date: Fri Aug 26 12:38:12 2016 -0700
search: add runtime warnings for invalid thread access
To make sure that search providers are using this properly, ensure we are
being called from the main thread.
libide/search/ide-search-context.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/libide/search/ide-search-context.c b/libide/search/ide-search-context.c
index 4b343b6..abacc41 100644
--- a/libide/search/ide-search-context.c
+++ b/libide/search/ide-search-context.c
@@ -62,6 +62,7 @@ ide_search_context_provider_completed (IdeSearchContext *self,
g_return_if_fail (IDE_IS_SEARCH_CONTEXT (self));
g_return_if_fail (IDE_IS_SEARCH_PROVIDER (provider));
g_return_if_fail (g_list_find (self->providers, provider));
+ g_return_if_fail (g_main_context_get_thread_default () == g_main_context_default ());
if (--self->in_progress == 0)
g_signal_emit (self, signals [COMPLETED], 0);
@@ -91,6 +92,7 @@ ide_search_context_add_result (IdeSearchContext *self,
g_return_if_fail (IDE_IS_SEARCH_CONTEXT (self));
g_return_if_fail (IDE_IS_SEARCH_PROVIDER (provider));
g_return_if_fail (IDE_IS_SEARCH_RESULT (result));
+ g_return_if_fail (g_main_context_get_thread_default () == g_main_context_default ());
g_signal_emit (self, signals [RESULT_ADDED], 0, provider, result);
}
@@ -103,6 +105,7 @@ ide_search_context_remove_result (IdeSearchContext *self,
g_return_if_fail (IDE_IS_SEARCH_CONTEXT (self));
g_return_if_fail (IDE_IS_SEARCH_PROVIDER (provider));
g_return_if_fail (IDE_IS_SEARCH_RESULT (result));
+ g_return_if_fail (g_main_context_get_thread_default () == g_main_context_default ());
g_signal_emit (self, signals [RESULT_REMOVED], 0, provider, result);
}
@@ -114,6 +117,7 @@ ide_search_context_set_provider_count (IdeSearchContext *self,
{
g_return_if_fail (IDE_IS_SEARCH_CONTEXT (self));
g_return_if_fail (IDE_IS_SEARCH_PROVIDER (provider));
+ g_return_if_fail (g_main_context_get_thread_default () == g_main_context_default ());
g_signal_emit (self, signals [COUNT_SET], 0, provider, count);
}
@@ -130,6 +134,7 @@ ide_search_context_execute (IdeSearchContext *self,
g_return_if_fail (IDE_IS_SEARCH_CONTEXT (self));
g_return_if_fail (!self->executed);
g_return_if_fail (search_terms);
+ g_return_if_fail (g_main_context_get_thread_default () == g_main_context_default ());
self->executed = TRUE;
self->in_progress = g_list_length (self->providers);
@@ -170,6 +175,7 @@ _ide_search_context_add_provider (IdeSearchContext *self,
g_return_if_fail (IDE_IS_SEARCH_CONTEXT (self));
g_return_if_fail (IDE_IS_SEARCH_PROVIDER (provider));
g_return_if_fail (!self->executed);
+ g_return_if_fail (g_main_context_get_thread_default () == g_main_context_default ());
self->providers = g_list_append (self->providers, g_object_ref (provider));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]