[nautilus/wip/oholy/properties-window-critical-fix: 1/3] properties-window: Fix crashes when cancelled



commit a20229f185b494a107634c4b99b2be1ce962a277
Author: Ondrej Holy <oholy redhat com>
Date:   Thu Sep 26 11:06:45 2019 +0200

    properties-window: Fix crashes when cancelled
    
    Nautilus crashes on the "timed_wait_free: assertion failed:
    (g_hash_table_lookup (timed_wait_hash_table, wait) != NULL)" assertion
    when the creating of the properties window is cancelled. This is because
    the timed wait has been already removed. Let's don't remove the wait
    when cancelled in order to prevent the crashes.

 src/nautilus-properties-window.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index 969e3ffea..0112aeb3c 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -148,6 +148,7 @@ typedef struct
     NautilusPropertiesWindowCallback callback;
     gpointer callback_data;
     NautilusPropertiesWindow *window;
+    gboolean cancelled;
 } StartupData;
 
 /* drag and drop definitions */
@@ -5229,6 +5230,8 @@ get_existing_window (GList *file_list)
 static void
 properties_window_finish (StartupData *data)
 {
+    gboolean cancel_timed_wait;
+
     if (data->parent_widget != NULL)
     {
         g_signal_handlers_disconnect_by_data (data->parent_widget,
@@ -5240,14 +5243,21 @@ properties_window_finish (StartupData *data)
                                               data);
     }
 
-    remove_pending (data, TRUE, (data->window == NULL), FALSE);
+    cancel_timed_wait = (data->window == NULL && !data->cancelled);
+    remove_pending (data, TRUE, cancel_timed_wait, FALSE);
+
     startup_data_free (data);
 }
 
 static void
 cancel_create_properties_window_callback (gpointer callback_data)
 {
-    properties_window_finish ((StartupData *) callback_data);
+    StartupData *data;
+
+    data = callback_data;
+    data->cancelled = TRUE;
+
+    properties_window_finish (data);
 }
 
 static void


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