[nautilus/wip/oholy/invalid-read] operations-ui-manager: Fix crash after a conflict dialog response



commit be6ce87a2a12dc33b17c103957111307cd461e5a
Author: Ondrej Holy <oholy redhat com>
Date:   Thu Jan 23 11:38:14 2020 +0100

    operations-ui-manager: Fix crash after a conflict dialog response
    
    After a conflict dialog response, Nautilus accesses an already released
    structure, which causes crashes for some people. Let's store pointer
    before releasing the structure in order to prevent the invalid reads.
    
    Fixes: https://gitlab.gnome.org/GNOME/nautilus/issues/1353

 src/nautilus-operations-ui-manager.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-operations-ui-manager.c b/src/nautilus-operations-ui-manager.c
index fbaac05c9..43dbaf053 100644
--- a/src/nautilus-operations-ui-manager.c
+++ b/src/nautilus-operations-ui-manager.c
@@ -486,6 +486,7 @@ copy_move_conflict_ask_user_action (GtkWindow *parent_window,
                                     GFile     *destination_directory_name)
 {
     FileConflictDialogData *data;
+    FileConflictResponse *response;
 
     data = g_slice_new0 (FileConflictDialogData);
     data->parent = parent_window;
@@ -502,9 +503,10 @@ copy_move_conflict_ask_user_action (GtkWindow *parent_window,
                               run_file_conflict_dialog,
                               data);
 
+    response = g_steal_pointer (&data->response);
     g_slice_free (FileConflictDialogData, data);
 
-    return data->response;
+    return response;
 }
 
 typedef struct


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