[gnome-commander] Refing files for deletion, fixing unrefing when cleaning up deleteData



commit c39c810af3943a31a87716e25882b74f7275aaef
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Fri Aug 27 23:14:21 2021 +0200

    Refing files for deletion, fixing unrefing when cleaning up deleteData

 src/dialogs/gnome-cmd-delete-dialog.cc | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/src/dialogs/gnome-cmd-delete-dialog.cc b/src/dialogs/gnome-cmd-delete-dialog.cc
index 237416c8..905fa5b0 100644
--- a/src/dialogs/gnome-cmd-delete-dialog.cc
+++ b/src/dialogs/gnome-cmd-delete-dialog.cc
@@ -43,7 +43,11 @@ using namespace std;
 inline void cleanup (DeleteData *deleteData)
 {
     gnome_cmd_file_list_free (deleteData->gnomeCmdFiles);
-    gnome_cmd_file_list_free (deleteData->deletedGnomeCmdFiles);
+
+    //Just set deletedGnomeCmdFiles back to null as it is a subset of gnomeCmdFiles
+    g_list_free (deleteData->deletedGnomeCmdFiles);
+    deleteData->deletedGnomeCmdFiles = nullptr;
+
     g_free (deleteData);
 }
 
@@ -504,5 +508,8 @@ void gnome_cmd_delete_dialog_show (GList *files)
 
     deleteData->gnomeCmdFiles = files;
 
+    // Refing files for the delete procedure
+    gnome_cmd_file_list_ref (deleteData->gnomeCmdFiles);
+
     do_delete (deleteData);
 }


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