diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2020-05-22 00:06:31 +0200 |
---|---|---|
committer | Jean Felder <jean.felder@gmail.com> | 2020-08-21 15:05:10 +0000 |
commit | dfc855ac7c0f2971e00b11df7ca6404c74925e04 (patch) | |
tree | 2af52da2c3e85f104cbf76fa7912332307eecb52 | |
parent | 9555ebeaf0385b533b91393eaea12b7ab1fa1b26 (diff) | |
download | grilo-plugins-dfc855ac7c0f2971e00b11df7ca6404c74925e04.tar.gz |
tracker3: Fold cancellable check with other error handling
The cursor will already error out if the cancellable was cancelled.
Check for that error and avoid checking the cancellable directly.
-rw-r--r-- | src/tracker3/grl-tracker-source-api.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/src/tracker3/grl-tracker-source-api.c b/src/tracker3/grl-tracker-source-api.c index e22e910..932c93f 100644 --- a/src/tracker3/grl-tracker-source-api.c +++ b/src/tracker3/grl-tracker-source-api.c @@ -332,17 +332,6 @@ get_sparql_type_filter (GrlOperationOptions *options, \ GRL_ODEBUG ("%s", __FUNCTION__); \ \ - if (g_cancellable_is_cancelled (os->cancel)) { \ - GRL_ODEBUG ("\tOperation %u cancelled", spec->operation_id); \ - spec->callback (spec->source, \ - spec->operation_id, \ - NULL, 0, \ - spec->user_data, NULL); \ - grl_tracker_queue_done (grl_tracker_queue, os); \ - \ - return; \ - } \ - \ if (!tracker_sparql_cursor_next_finish (os->cursor, \ result, \ &tracker_error)) { \ @@ -350,17 +339,18 @@ get_sparql_type_filter (GrlOperationOptions *options, GRL_WARNING ("\terror in parsing query id=%u : %s", \ spec->operation_id, tracker_error->message); \ \ - error = g_error_new (GRL_CORE_ERROR, \ - GRL_CORE_ERROR_##error##_FAILED, \ - _("Failed to query: %s"), \ - tracker_error->message); \ + if (!g_error_matches (tracker_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) \ + error = g_error_new (GRL_CORE_ERROR, \ + GRL_CORE_ERROR_##error##_FAILED, \ + _("Failed to query: %s"), \ + tracker_error->message); \ \ spec->callback (spec->source, \ spec->operation_id, \ NULL, 0, \ spec->user_data, error); \ \ - g_error_free (error); \ + g_clear_error (&error); \ g_error_free (tracker_error); \ } else { \ GRL_ODEBUG ("\tend of parsing id=%u :)", spec->operation_id); \ |