diff options
author | Olivier CrĂȘte <olivier.crete@collabora.com> | 2023-05-17 01:08:34 +0100 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@collabora.com> | 2023-05-17 01:10:23 +0100 |
commit | 22cd3ea2683f2fee9a7c2bb1ebc6be619153add2 (patch) | |
tree | da6ba655be9bbccdbb20a5b654a64697c7a7f4cd | |
parent | d517b25ea3eed3bafbd6e76ab1a2622c82ac7488 (diff) | |
download | gtk+-22cd3ea2683f2fee9a7c2bb1ebc6be619153add2.tar.gz |
pathbar: Fail setting the path on cancellation
The cancellation path already clears the GCancellable, if we let it
continue, it causes a later assertion, so just exit early in this case
and hope a new path has been set.
Fixes: #5792
-rw-r--r-- | gtk/gtkpathbar.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c index e8a3b2fc06..d712bec277 100644 --- a/gtk/gtkpathbar.c +++ b/gtk/gtkpathbar.c @@ -873,8 +873,18 @@ gtk_path_bar_get_mount_callback (GObject *source, { GFile *file = G_FILE (source); struct SetFileInfo *file_info = data; + GError *error = NULL; - file_info->mount = g_file_find_enclosing_mount_finish (file, result, NULL); + file_info->mount = g_file_find_enclosing_mount_finish (file, result, + &error); + + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + { + gtk_path_bar_set_file_finish (file_info, FALSE); + g_clear_error (&error); + return; + } + g_clear_error (&error); if (file_info->mount) file_info->root_file = g_mount_get_root (file_info->mount); |