summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2023-04-10 16:02:33 +0200
committerCarlos Garnacho <carlosg@gnome.org>2023-05-15 09:30:52 +0000
commit27bad86ec90586488a26087e4c51caf0808532e7 (patch)
tree5e8be42d2cd271b92d36e2e2db712565f6a8c846
parent7d10deb89ac7e68883fa2286e95036deeab35efc (diff)
downloadtracker-27bad86ec90586488a26087e4c51caf0808532e7.tar.gz
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.
-rw-r--r--src/libtracker-sparql/tracker-notifier.c8
1 files changed, 7 insertions, 1 deletions
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)) {