[tracker/wip/carlosg/test-error-fixes: 3/5] libtracker-sparql: Add early cancellation check on query tasks




commit f25c376433da1c9bfa8f869ea7d35ea46ca5f57c
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Jul 13 12:21:56 2021 +0200

    libtracker-sparql: Add early cancellation check on query tasks
    
    In the direct connection, add an early check for the task being
    cancelled by the time it's going to be executed.

 src/libtracker-sparql/direct/tracker-direct-statement.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/src/libtracker-sparql/direct/tracker-direct-statement.c 
b/src/libtracker-sparql/direct/tracker-direct-statement.c
index 4a281de5d..53e87883d 100644
--- a/src/libtracker-sparql/direct/tracker-direct-statement.c
+++ b/src/libtracker-sparql/direct/tracker-direct-statement.c
@@ -167,6 +167,9 @@ execute_in_thread (GTask        *task,
        GHashTable *values = task_data;
        GError *error = NULL;
 
+       if (g_task_return_error_if_cancelled (task))
+               return;
+
        priv = tracker_direct_statement_get_instance_private (object);
        cursor = tracker_sparql_execute_cursor (priv->sparql, values, &error);
 


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