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:
parent
d7c7311ceb
commit
aedcfcd010
1 changed files with 3 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue