filechooser: Prevent a crash

With csd, we are handling external widgets when
there is an entry in the headerbar. Use a weak ref
to prevent that pointer from going stale. This fixes
a crash when cancelling a save dialog.

Fixes: #3110
This commit is contained in:
Matthias Clasen 2020-09-12 10:40:13 -04:00
parent 7ee3439522
commit 756c52ef08

View File

@ -2322,6 +2322,7 @@ save_widgets_create (GtkFileChooserWidget *impl)
{
location_entry_disconnect (impl);
impl->location_entry = impl->external_entry;
g_object_add_weak_pointer (impl->external_entry, (gpointer *)&impl->location_entry);
location_entry_setup (impl);
g_signal_connect_after (gtk_entry_get_key_controller (GTK_ENTRY (impl->external_entry)),