[gtk/gtk-4-4] filechooserportal: Take a ref on transient-for



commit 19adb3b8b3070e871a4b2844e48e39f44b0fe0ca
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Oct 6 22:37:45 2021 -0400

    filechooserportal: Take a ref on transient-for
    
    This may fix a crash that has been reported in
    file_chooser_portal_data_free.
    
    Fixes: #4314

 gtk/gtkfilechoosernativeportal.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkfilechoosernativeportal.c b/gtk/gtkfilechoosernativeportal.c
index d65229f6ef..d31337931e 100644
--- a/gtk/gtkfilechoosernativeportal.c
+++ b/gtk/gtkfilechoosernativeportal.c
@@ -79,6 +79,8 @@ filechooser_portal_data_free (FilechooserPortalData *data)
   if (data->exported_window)
     gtk_window_unexport_handle (data->exported_window);
 
+  g_clear_object (&data->exported_window);
+
   g_free (data->portal_handle);
 
   g_free (data);
@@ -501,7 +503,7 @@ gtk_file_chooser_native_portal_show (GtkFileChooserNative *self,
         }
       else
         {
-          data->exported_window = transient_for;
+          data->exported_window = g_object_ref (transient_for);
         }
     }
   else


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