[nautilus] trash-monitor: Fix crash when launching nautilus after shutdown starts



commit 27137a1c46c22ff17635f9f59fa06596ce90e503
Author: Corey Berla <corey berla me>
Date:   Mon Jul 25 08:54:12 2022 -0700

    trash-monitor: Fix crash when launching nautilus after shutdown starts
    
    eel-debug-shutdown unrefs the trash-monitor but doesn't set it to
    NULL.  The nautilus_trash_monitor_get () function only creates a
    new trash_monitor when the static variable nautilus_trash_monitor
    is set to null.  Simply set nautilus_trash_montior to NULL after
    unreffing.
    
    Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2064

 src/nautilus-trash-monitor.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/nautilus-trash-monitor.c b/src/nautilus-trash-monitor.c
index 2e2beaa65..366116f59 100644
--- a/src/nautilus-trash-monitor.c
+++ b/src/nautilus-trash-monitor.c
@@ -215,9 +215,9 @@ nautilus_trash_monitor_init (NautilusTrashMonitor *trash_monitor)
 }
 
 static void
-unref_trash_monitor (void)
+clear_trash_monitor_on_shutdown (void)
 {
-    g_object_unref (nautilus_trash_monitor);
+    g_clear_object (&nautilus_trash_monitor);
 }
 
 NautilusTrashMonitor *
@@ -229,7 +229,7 @@ nautilus_trash_monitor_get (void)
 
         nautilus_trash_monitor = NAUTILUS_TRASH_MONITOR
                                      (g_object_new (NAUTILUS_TYPE_TRASH_MONITOR, NULL));
-        eel_debug_call_at_shutdown (unref_trash_monitor);
+        eel_debug_call_at_shutdown (clear_trash_monitor_on_shutdown);
     }
 
     return nautilus_trash_monitor;


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