[nautilus/wip/ernestask/search-fix] search-engine: Query file system to determine remoteness
- From: Ernestas Kulik <ernestask src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/ernestask/search-fix] search-engine: Query file system to determine remoteness
- Date: Wed, 19 Sep 2018 14:31:33 +0000 (UTC)
commit 864df43c9b8f744018bee1d176eeba05dbeedf40
Author: Ernestas Kulik <ernestask gnome org>
Date: Fri Sep 14 13:52:11 2018 +0300
search-engine: Query file system to determine remoteness
Querying the file cache in is_recursive_search() does not guarantee that
the file system field will be populated with a value, and somehow
results in data races, in turn resulting in random crashes/file list
corruption.
Hopefully fixes https://gitlab.gnome.org/GNOME/nautilus/issues/640,
closes https://gitlab.gnome.org/GNOME/nautilus/issues/632 and resolves
https://gitlab.gnome.org/GNOME/nautilus/issues/602
src/nautilus-file.c | 8 +++++++-
src/nautilus-file.h | 1 +
src/nautilus-search-engine.c | 16 ++++++++++++++--
3 files changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index dc3a788d0..a0d8f0db9 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -8077,6 +8077,12 @@ static const gchar * const remote_types[] =
NULL
};
+gboolean
+nautilus_file_system_is_remote (const char *file_system)
+{
+ return file_system != NULL && g_strv_contains (remote_types, file_system);
+}
+
/**
* nautilus_file_is_remote
*
@@ -8100,7 +8106,7 @@ nautilus_file_is_remote (NautilusFile *file)
filesystem_type = nautilus_file_get_filesystem_type (file);
- return filesystem_type != NULL && g_strv_contains (remote_types, filesystem_type);
+ return nautilus_file_system_is_remote (filesystem_type);
}
/**
diff --git a/src/nautilus-file.h b/src/nautilus-file.h
index 8fce62505..97b69087b 100644
--- a/src/nautilus-file.h
+++ b/src/nautilus-file.h
@@ -214,6 +214,7 @@ gboolean nautilus_file_is_in_trash (Nautilu
gboolean nautilus_file_is_in_recent (NautilusFile
*file);
gboolean nautilus_file_is_in_starred (NautilusFile
*file);
gboolean nautilus_file_is_in_admin (NautilusFile
*file);
+gboolean nautilus_file_system_is_remote (const char
*file_system);
gboolean nautilus_file_is_remote (NautilusFile
*file);
gboolean nautilus_file_is_other_locations (NautilusFile
*file);
gboolean nautilus_file_is_starred_location (NautilusFile
*file);
diff --git a/src/nautilus-search-engine.c b/src/nautilus-search-engine.c
index 23c1c7e88..ebd10c801 100644
--- a/src/nautilus-search-engine.c
+++ b/src/nautilus-search-engine.c
@@ -563,8 +563,20 @@ is_recursive_search (NautilusSearchEngineType engine_type,
case NAUTILUS_QUERY_RECURSIVE_LOCAL_ONLY:
{
- g_autoptr (NautilusFile) file = nautilus_file_get (location);
- return !nautilus_file_is_remote (file);
+ g_autoptr (GFileInfo) file_system_info = NULL;
+
+ file_system_info = g_file_query_filesystem_info (location,
+ G_FILE_ATTRIBUTE_FILESYSTEM_TYPE,
+ NULL, NULL);
+ if (file_system_info != NULL)
+ {
+ const char *file_system;
+
+ file_system = g_file_info_get_attribute_string (file_system_info,
+ G_FILE_ATTRIBUTE_FILESYSTEM_TYPE);
+
+ return !nautilus_file_system_is_remote (file_system);
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]