1
0
Fork 0

sound-player: Fix invalid write after playback is cancelled early

The cancellable of a request might already be cancelled by the time
the cancelled_cb is connected resulting in finish_cb being called via
ca_context_cancel before g_cancellable_connect returns. In this case
the request that is written to has already been freed.

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/1060
This commit is contained in:
Sebastian Keller 2020-02-21 10:14:01 +01:00 committed by Carlos Garnacho
parent d7c7311ceb
commit aedcfcd010

View file

@ -140,9 +140,11 @@ play_sound (MetaPlayRequest *req,
if (req->cancellable)
{
req->cancel_id =
gulong cancel_id =
g_cancellable_connect (req->cancellable,
G_CALLBACK (cancelled_cb), req, NULL);
if (cancel_id)
req->cancel_id = cancel_id;
}
}