[nautilus] window-slot: Don't initialize extra widgets if content view is not yet set



commit 73876bdcdf2d0e5fe3513132770f06eddf9fd606
Author: Andrea Azzarone <andrea azzarone canonical com>
Date:   Thu Mar 14 19:11:08 2019 +0000

    window-slot: Don't initialize extra widgets if content view is not yet set
    
    The signal 'trash-state-changed' could be emitted by NautilusTrashMonitor while
    a NautilusWindowSlot is still initializing the content view. In this case, don't
    show/hide extra location widgets to avoid deferencing invalid memory. They will
    be created anyway once the content view has been set.
    
    Closes: https://gitlab.gnome.org/GNOME/nautilus/issues/890
    Closes: https://gitlab.gnome.org/GNOME/nautilus/issues/862

 src/nautilus-window-slot.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 7bec9a0d8..bf26cda3e 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -2696,10 +2696,15 @@ trash_state_changed_cb (NautilusTrashMonitor *monitor,
 {
     GFile *location;
     NautilusDirectory *directory;
+    NautilusView *view;
 
     location = nautilus_window_slot_get_current_location (user_data);
+    view = nautilus_window_slot_get_current_view (user_data);
 
-    if (location == NULL)
+    /* The signal 'trash-state-changed' could be emitted by NautilusTrashMonitor
+     * while a NautilusWindowSlot is still initializing the content view.
+     */
+    if (location == NULL || view == NULL)
     {
         return;
     }


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