mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
sound-player: Don't deadlock in finish_cb
The function finish_cb can be called as a result of a call to ca_context_cancel in cancelled_cb. This will result in a deadlock because, as per documentation, g_cancellable_disconnect cannot be called inside the cancellable handler. It is possible to detect if the call to finish_cb is caused by ca_context_cancel checking if error_code == CA_ERROR_CANCELED. To avoid the deadlock we should call g_signal_handler_disconnect instead g_cancellable_disconnect if this is the case. https://gitlab.gnome.org/GNOME/mutter/merge_requests/474
This commit is contained in:
parent
b0fb39bb54
commit
8856a396fd
@ -117,7 +117,11 @@ finish_cb (ca_context *context,
|
|||||||
{
|
{
|
||||||
MetaPlayRequest *req = user_data;
|
MetaPlayRequest *req = user_data;
|
||||||
|
|
||||||
|
if (error_code != CA_ERROR_CANCELED)
|
||||||
g_cancellable_disconnect (req->cancellable, req->cancel_id);
|
g_cancellable_disconnect (req->cancellable, req->cancel_id);
|
||||||
|
else if (req->cancellable != NULL && req->cancel_id != 0)
|
||||||
|
g_signal_handler_disconnect (req->cancellable, req->cancel_id);
|
||||||
|
|
||||||
meta_play_request_free (req);
|
meta_play_request_free (req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user