mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-10-25 14:32:16 +02:00
gopenuriportal: Fix a crash when the file can’t be opened
Rather than reporting an error via a new `GTask`, report it via the `GTask` we’ve already created. This avoids a critical warning about destroying the `GTask` without returning a result. Also ensure to disconnect the D-Bus signal subscription first, to avoid an assertion failure in `call_data_free()`. Signed-off-by: Philip Withnall <pwithnall@gnome.org> Fixes: #3798
This commit is contained in:
@@ -352,10 +352,13 @@ g_openuri_portal_open_file_async (GFile *file,
|
||||
errsv = errno;
|
||||
if (fd == -1)
|
||||
{
|
||||
g_clear_object (&task);
|
||||
g_task_report_new_error (NULL, callback, user_data, NULL,
|
||||
g_task_return_new_error (task,
|
||||
G_IO_ERROR, g_io_error_from_errno (errsv),
|
||||
"Failed to open ‘%s’: %s", path, g_strerror (errsv));
|
||||
|
||||
if (call_data != NULL)
|
||||
g_dbus_connection_signal_unsubscribe (connection, g_steal_handle_id (&call_data->response_signal_id));
|
||||
g_clear_object (&task);
|
||||
g_clear_object (&openuri);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user