From 27bad86ec90586488a26087e4c51caf0808532e7 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Mon, 10 Apr 2023 16:02:33 +0200 Subject: libtracker-sparql: Check cancellable more often in TrackerNotifier While handling the URN query cursor, we did not check the cancellable and went all through with it, even if TrackerNotifier finalization paths might have cancelled the task. This could not happen in practice since the cache struct takes a reference on the TrackerNotifier, but will happen with future commits. --- src/libtracker-sparql/tracker-notifier.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libtracker-sparql/tracker-notifier.c b/src/libtracker-sparql/tracker-notifier.c index f67c7a3d3..63cf0e61f 100644 --- a/src/libtracker-sparql/tracker-notifier.c +++ b/src/libtracker-sparql/tracker-notifier.c @@ -498,7 +498,7 @@ handle_cursor (GTask *task, * extracted from the GSequence, the latter because of the ORDER BY * clause. */ - while (tracker_sparql_cursor_next (cursor, NULL, NULL)) { + while (tracker_sparql_cursor_next (cursor, cancellable, NULL)) { id = tracker_sparql_cursor_get_integer (cursor, 0); event = g_sequence_get (iter); iter = g_sequence_iter_next (iter); @@ -513,6 +513,12 @@ handle_cursor (GTask *task, } tracker_sparql_cursor_close (cursor); + + if (g_task_return_error_if_cancelled (task)) { + _tracker_notifier_event_cache_free (cache); + return; + } + cache->first = iter; if (g_sequence_iter_is_end (cache->first)) { -- cgit v1.2.1