mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-11-04 19:08:23 +00:00
internal-place-file: Don't access self pointer after destruction
If the file is destroyed before the mount operation is completed, we cancel the mount operation. However, due to the nature of GAsyncResult, the callback is still called in a future iteration of the main loop, when the file is long gone. But since it's passed as callback data, we try to cast it, with predictably bad results. Access the file pointer only if the operation hasn't been cancelled.
This commit is contained in:
parent
12980ee1bd
commit
16b81477b3
1 changed files with 2 additions and 1 deletions
|
@ -51,7 +51,6 @@ network_mount_callback (GObject *source_object,
|
|||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
{
|
||||
NautilusInternalPlaceFile *self = NAUTILUS_INTERNAL_PLACE_FILE (data);
|
||||
g_autoptr (GError) error = NULL;
|
||||
|
||||
(void) g_file_mount_enclosing_volume_finish (G_FILE (source_object), result, &error);
|
||||
|
@ -60,6 +59,8 @@ network_mount_callback (GObject *source_object,
|
|||
return;
|
||||
}
|
||||
|
||||
NautilusInternalPlaceFile *self = NAUTILUS_INTERNAL_PLACE_FILE (data);
|
||||
|
||||
/* Clear cancellable and steal callbacks list because call_when_ready() may
|
||||
* be called again inside the `for` loop. */
|
||||
g_clear_object (&self->network_mount_cancellable);
|
||||
|
|
Loading…
Reference in a new issue