[nautilus: 1/2] list-view: Don't try to get fts snippet for dummy row
- From: António Jorge Pinto Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus: 1/2] list-view: Don't try to get fts snippet for dummy row
- Date: Tue, 7 Nov 2017 15:42:10 +0000 (UTC)
commit 0a67e3d5bbb283228d5daf576d63fb7847009cce
Author: António Fernandes <antoniojpfernandes gmail com>
Date: Fri Oct 20 00:36:10 2017 +0000
list-view: Don't try to get fts snippet for dummy row
If org.gnome.nautilus.list-view use-tree-view is TRUE, folders can
be expanded, which creates a dummy row to display the "Loading" label.
When displaying search results as a list, we look for the fts_snippet
on every row's NautilusFile, but this causes a crash when a dummy row is
created, because its NautilusFile is NULL.
Therefore, we should not look for fts_snippet on dummy rows.
Fixes: https://gitlab.gnome.org/GNOME/nautilus/issues/54
src/nautilus-list-view.c | 35 +++++++++++++++++++----------------
1 files changed, 19 insertions(+), 16 deletions(-)
---
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index 759e3b1..dc2280c 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -1611,24 +1611,27 @@ filename_cell_data_func (GtkTreeViewColumn *column,
NAUTILUS_LIST_MODEL_FILE_COLUMN, &file,
-1);
- snippet = nautilus_file_get_search_fts_snippet (file);
- if (snippet)
+ /* Rule out dummy row */
+ if (file != NULL)
{
- replaced_text = g_regex_replace (view->details->regex,
- snippet,
- -1,
- 0,
- " ",
- G_REGEX_MATCH_NEWLINE_ANY,
- NULL);
+ snippet = nautilus_file_get_search_fts_snippet (file);
+ if (snippet)
+ {
+ replaced_text = g_regex_replace (view->details->regex,
+ snippet,
+ -1,
+ 0,
+ " ",
+ G_REGEX_MATCH_NEWLINE_ANY,
+ NULL);
- escaped_text = g_markup_escape_text (replaced_text, -1);
+ escaped_text = g_markup_escape_text (replaced_text, -1);
- g_string_append_printf (display_text,
- " <small><span color='grey'><b>%s</b></span></small>",
- escaped_text);
+ g_string_append_printf (display_text,
+ " <small><span color='grey'><b>%s</b></span></small>",
+ escaped_text);
+ }
}
-
nautilus_file_unref (file);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]