[gtk+/gtk-2-24] GtkFileChooser: Don't crash if invisible files are deleted
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-24] GtkFileChooser: Don't crash if invisible files are deleted
- Date: Thu, 10 Mar 2016 21:34:01 +0000 (UTC)
commit d5a7fbc2a732cc0ffad405861dc2d25cf0a31b38
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Dec 11 22:52:59 2014 -0500
GtkFileChooser: Don't crash if invisible files are deleted
This is a crash that has been around for a long time, as
can be seen here:
https://bugzilla.redhat.com/show_bug.cgi?id=1048388
https://bugzilla.redhat.com/show_bug.cgi?id=984375
https://bugzilla.redhat.com/show_bug.cgi?id=1159015
https://bugzilla.redhat.com/show_bug.cgi?id=1059187
https://bugzilla.redhat.com/show_bug.cgi?id=1122172
https://bugzilla.redhat.com/show_bug.cgi?id=1016895
https://bugzilla.redhat.com/show_bug.cgi?id=1133235
https://bugzilla.redhat.com/show_bug.cgi?id=1077500
https://bugzilla.redhat.com/show_bug.cgi?id=1054378
https://bugzilla.redhat.com/show_bug.cgi?id=1173212
Fix suggested by Benjamin Otte.
gtk/gtkfilesystemmodel.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkfilesystemmodel.c b/gtk/gtkfilesystemmodel.c
index 307eec8..840f1e8 100644
--- a/gtk/gtkfilesystemmodel.c
+++ b/gtk/gtkfilesystemmodel.c
@@ -1888,6 +1888,7 @@ remove_file (GtkFileSystemModel *model,
GFile *file)
{
FileModelNode *node;
+ gboolean was_visible;
guint id;
guint row;
@@ -1899,6 +1900,7 @@ remove_file (GtkFileSystemModel *model,
return;
node = get_node (model, id);
+ was_visible = node->visible;
row = node_get_tree_row (model, id);
node_invalidate_index (model, id);
@@ -1914,7 +1916,8 @@ remove_file (GtkFileSystemModel *model,
/* We don't need to resort, as removing a row doesn't change the sorting order of the other rows */
- emit_row_deleted_for_row (model, row);
+ if (was_visible)
+ emit_row_deleted_for_row (model, row);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]