Merged requested to merge ebassi/issue-4883 into main
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 (closed)