[nautilus/wip/corey/fix-sort: 19/19] list-view: Set model sorter to NULL on dispose
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/corey/fix-sort: 19/19] list-view: Set model sorter to NULL on dispose
- Date: Fri, 21 Oct 2022 01:02:52 +0000 (UTC)
commit a81aeac7fe22edbe37f1bc87afe8272b5e71980e
Author: António Fernandes <antoniof gnome org>
Date: Fri Oct 21 00:22:27 2022 +0100
list-view: Set model sorter to NULL on dispose
This avoids future emissions of a "changed" signal during destruction.
Also fix setter not to connect to signals when the sorter is NULL.
src/nautilus-list-view.c | 4 ++++
src/nautilus-view-model.c | 9 ++++++---
2 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index 58a75f857..7960d6ad8 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -1207,6 +1207,10 @@ static void
nautilus_list_view_dispose (GObject *object)
{
NautilusListView *self = NAUTILUS_LIST_VIEW (object);
+ NautilusViewModel *model;
+
+ model = nautilus_list_base_get_model (NAUTILUS_LIST_BASE (self));
+ nautilus_view_model_set_sorter (model, NULL);
g_clear_object (&self->file_path_base_location);
g_clear_pointer (&self->factory_to_column_map, g_hash_table_destroy);
diff --git a/src/nautilus-view-model.c b/src/nautilus-view-model.c
index ba59329f2..2d472ef6c 100644
--- a/src/nautilus-view-model.c
+++ b/src/nautilus-view-model.c
@@ -301,9 +301,12 @@ nautilus_view_model_set_sorter (NautilusViewModel *self,
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SORTER]);
}
- self->sorter_changed_id = g_signal_connect (self->sorter, "changed",
- G_CALLBACK (on_sorter_changed), self);
- g_list_store_sort (self->internal_model, compare_data_func, self);
+ if (self->sorter != NULL)
+ {
+ self->sorter_changed_id = g_signal_connect (self->sorter, "changed",
+ G_CALLBACK (on_sorter_changed), self);
+ g_list_store_sort (self->internal_model, compare_data_func, self);
+ }
}
GQueue *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]