[tracker/wip/carlosg/wal-and-other-fixes: 5/8] libtracker-sparql: Also close endpoint cursors in the dispatch thread



commit 24843bdd0c052dfc158785610c0120beab5c7e93
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Jun 30 10:03:49 2020 +0200

    libtracker-sparql: Also close endpoint cursors in the dispatch thread
    
    We handle cursor for endpoint queries in a thread, but return to the
    main context thread and close the cursor there. This is an operation
    that can block if the underlying TrackerDBInterface were used from
    multiple threads, so better not do this blocking operation in the
    main thread.

 src/libtracker-sparql/tracker-endpoint-dbus.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/libtracker-sparql/tracker-endpoint-dbus.c b/src/libtracker-sparql/tracker-endpoint-dbus.c
index b03836a9d..70ecd8397 100644
--- a/src/libtracker-sparql/tracker-endpoint-dbus.c
+++ b/src/libtracker-sparql/tracker-endpoint-dbus.c
@@ -300,6 +300,8 @@ handle_cursor_reply (GTask        *task,
        g_free (variable_names);
        g_clear_error (&write_error);
 
+       tracker_sparql_cursor_close (cursor);
+
        g_task_return_boolean (task, TRUE);
 }
 
@@ -314,7 +316,6 @@ finish_query (GObject      *source_object,
        if (!g_task_propagate_boolean (G_TASK (res), &error))
                g_critical ("Error writing cursor: %s\n", error->message);
 
-       tracker_sparql_cursor_close (cursor);
        g_object_unref (cursor);
        g_clear_error (&error);
 }


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