[tracker/wip/carlosg/serialize-api: 38/53] libtracker-sparql: Fix refcount management of a serializer's cursor




commit 2da111d7e8235b3cddd0024aa32f34424a822235
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Nov 21 11:57:18 2021 +0100

    libtracker-sparql: Fix refcount management of a serializer's cursor
    
    The serializer is not taking a ref on the related cursor, but dropping
    one on finalize. Make it take a ref during its lifetime on the cursor,
    and change the only user so it doesn't account for this oddity.

 src/libtracker-sparql/tracker-endpoint-http.c | 1 +
 src/libtracker-sparql/tracker-serializer.c    | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/libtracker-sparql/tracker-endpoint-http.c b/src/libtracker-sparql/tracker-endpoint-http.c
index 4ff89d6f9..0d56bd561 100644
--- a/src/libtracker-sparql/tracker-endpoint-http.c
+++ b/src/libtracker-sparql/tracker-endpoint-http.c
@@ -202,6 +202,7 @@ query_async_cb (GObject      *object,
        request->task = g_task_new (endpoint_http, endpoint_http->cancellable,
                                    request_finished_cb, request);
        g_task_set_task_data (request->task, request, NULL);
+       g_object_unref (cursor);
 
        g_task_run_in_thread (request->task, handle_request_in_thread);
 }
diff --git a/src/libtracker-sparql/tracker-serializer.c b/src/libtracker-sparql/tracker-serializer.c
index eeed04b92..786299037 100644
--- a/src/libtracker-sparql/tracker-serializer.c
+++ b/src/libtracker-sparql/tracker-serializer.c
@@ -69,7 +69,7 @@ tracker_serializer_set_property (GObject      *object,
 
        switch (prop_id) {
        case PROP_CURSOR:
-               priv->cursor = g_value_get_object (value);
+               priv->cursor = g_value_dup_object (value);
                break;
        default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]