[nautilus] window-slot: Clear pending_selection after freeing it



commit d1547407ca3f0c4cc02acd485f24edb6cca85fa7
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Thu Apr 19 04:19:51 2018 -0500

    window-slot: Clear pending_selection after freeing it
    
    This might not be the case when handling archive files, in fact we were
    freeing the list and assigning it to a new value for non-archive files,
    but in case of archives the list was just freed and the invalid pointer
    kept around, potentially causing a later crash.

 src/nautilus-window-slot.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
---
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 2fa9c3339..541dd24a8 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -1611,11 +1611,7 @@ handle_regular_file_if_needed (NautilusWindowSlot *self,
     if ((parent_file != NULL) &&
         nautilus_file_get_file_type (file) == G_FILE_TYPE_REGULAR)
     {
-        if (priv->pending_selection != NULL)
-        {
-            nautilus_file_list_free (priv->pending_selection);
-        }
-
+        g_clear_pointer (&priv->pending_selection, nautilus_file_list_free);
         g_clear_object (&priv->pending_location);
         g_clear_object (&priv->pending_file_to_activate);
         g_free (priv->pending_scroll_to);


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