[nautilus/wip/antoniof/new-list-view-continuation] list-view: Check if self is NULL before getting listbase



commit 71ac5a047a37b08926c6cde3efa61e471194d813
Author: Corey Berla <corey berla me>
Date:   Sun Jul 17 23:17:03 2022 -0700

    list-view: Check if self is NULL before getting listbase
    
    If the view is no longer available i.e. switched to the GridView,
    this crashes.  Simply move the call to nautilus_list_base_get_model()
    after the NULL check.

 src/nautilus-list-view.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index d7f646079..ec2b98727 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -926,11 +926,13 @@ unload_file_timeout (gpointer data)
 {
     g_autoptr (UnloadDelayData) unload_data = data;
     NautilusListView *self = unload_data->self;
-    NautilusViewModel *model = nautilus_list_base_get_model (NAUTILUS_LIST_BASE (self));
+    NautilusViewModel *model;
+
     if (unload_data->self == NULL)
     {
         return G_SOURCE_REMOVE;
     }
+    model = nautilus_list_base_get_model (NAUTILUS_LIST_BASE (self));
 
     for (guint i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (model)); i++)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]