Keep FileChooserNative alive while a portal is running
authorEmmanuele Bassi <ebassi@gnome.org>
Fri, 29 Apr 2022 14:18:02 +0000 (15:18 +0100)
committerEmmanuele Bassi <ebassi@gnome.org>
Fri, 29 Apr 2022 14:27:10 +0000 (15:27 +0100)
commit196ec107d1756aa3ef18bdb7b4d384402f5bd1a2
treeda6ac7e6160fa18b5b5c5e58c1f99344c33ae0c0
parentb3f04413b486bd3eb7fbb13658b60aa4c517cd1c
Keep FileChooserNative alive while a portal is running

Even if the FileChooserNative instance drops out on us while we're still
waiting for the portal to answer, we should keep the data and pointers
alive until the sequence of asynchronous operations is running. The code
already tries to do that, by acquiring a strong reference to the
GtkFileChooserNative instance, but it's also freeing data as soon as the
dialog is hidden, while asynchronous callbacks that will look at the
fields on that data are still in flight.

To avoid that, we defer freeing the data until the asynchronous
callbacks are invoked, and we keep a reference on the dialog while we're
emitting signals on it.

Fixes: #4883
gtk/gtkfilechoosernativeportal.c