[gnome-builder] search: make provider search_finish() transfer-full
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] search: make provider search_finish() transfer-full
- Date: Mon, 9 Apr 2018 23:14:23 +0000 (UTC)
commit 1f63146a61a61bbb89efe8bcb94c2ce631546cc4
Author: Christian Hergert <chergert redhat com>
Date: Mon Apr 9 16:13:34 2018 -0700
search: make provider search_finish() transfer-full
This simplifies the process of implementing search providers from language
bindings.
src/libide/search/ide-search-engine.c | 2 ++
src/libide/search/ide-search-provider.c | 2 +-
src/plugins/code-index/ide-code-index-search-provider.c | 2 +-
src/plugins/file-search/gb-file-search-provider.c | 6 +++++-
4 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/libide/search/ide-search-engine.c b/src/libide/search/ide-search-engine.c
index d4143f2ed..8a7d419d7 100644
--- a/src/libide/search/ide-search-engine.c
+++ b/src/libide/search/ide-search-engine.c
@@ -26,6 +26,7 @@
#include "search/ide-search-provider.h"
#include "search/ide-search-result.h"
#include "threading/ide-task.h"
+#include "util/ide-glib.h"
#define DEFAULT_MAX_RESULTS 50
@@ -193,6 +194,7 @@ ide_search_engine_search_cb (GObject *object,
g_assert (G_IS_LIST_STORE (r->store));
ar = ide_search_provider_search_finish (provider, result, &error);
+ IDE_PTR_ARRAY_SET_FREE_FUNC (ar, g_object_unref);
if (error != NULL)
{
diff --git a/src/libide/search/ide-search-provider.c b/src/libide/search/ide-search-provider.c
index 20030dee5..db096385e 100644
--- a/src/libide/search/ide-search-provider.c
+++ b/src/libide/search/ide-search-provider.c
@@ -86,7 +86,7 @@ ide_search_provider_search_async (IdeSearchProvider *self,
*
* Completes a request to a search provider.
*
- * Returns: (transfer container) (element-type Ide.SearchResult): a #GPtrArray
+ * Returns: (transfer full) (element-type Ide.SearchResult): a #GPtrArray
* of #IdeSearchResult elements.
*/
GPtrArray *
diff --git a/src/plugins/code-index/ide-code-index-search-provider.c
b/src/plugins/code-index/ide-code-index-search-provider.c
index de2b2ad8e..9fe3dc969 100644
--- a/src/plugins/code-index/ide-code-index-search-provider.c
+++ b/src/plugins/code-index/ide-code-index-search-provider.c
@@ -105,7 +105,7 @@ ide_code_index_search_provider_search_finish (IdeSearchProvider *provider,
ar = ide_task_propagate_pointer (IDE_TASK (result), error);
- IDE_RETURN (ar);
+ IDE_RETURN (IDE_PTR_ARRAY_STEAL_FULL (&ar));
}
static void
diff --git a/src/plugins/file-search/gb-file-search-provider.c
b/src/plugins/file-search/gb-file-search-provider.c
index ba7345cec..977755a28 100644
--- a/src/plugins/file-search/gb-file-search-provider.c
+++ b/src/plugins/file-search/gb-file-search-provider.c
@@ -70,10 +70,14 @@ gb_file_search_provider_search_finish (IdeSearchProvider *provider,
GAsyncResult *result,
GError **error)
{
+ GPtrArray *ret;
+
g_assert (GB_IS_FILE_SEARCH_PROVIDER (provider));
g_assert (IDE_IS_TASK (result));
- return ide_task_propagate_pointer (IDE_TASK (result), error);
+ ret = ide_task_propagate_pointer (IDE_TASK (result), error);
+
+ return IDE_PTR_ARRAY_STEAL_FULL (&ret);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]