gdk/wayland: Avoid invalid memory access on cancellation
The only way to have G_IO_ERROR_CANCELLED in the write callback goes through having the array of pending writers already cleared. It should not access the invalid AsyncWriteData and StoredSelection in that case.
This commit is contained in:
@ -734,13 +734,14 @@ async_write_data_cb (GObject *object,
|
||||
res, &error);
|
||||
if (error)
|
||||
{
|
||||
if (error->domain != G_IO_ERROR ||
|
||||
error->code != G_IO_ERROR_CANCELLED)
|
||||
g_warning ("Error writing selection data: %s", error->message);
|
||||
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
|
||||
{
|
||||
g_warning ("Error writing selection data: %s", error->message);
|
||||
g_ptr_array_remove_fast (write_data->stored_selection->pending_writes,
|
||||
write_data);
|
||||
}
|
||||
|
||||
g_error_free (error);
|
||||
g_ptr_array_remove_fast (write_data->stored_selection->pending_writes,
|
||||
write_data);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user