pulse: protect context

Make sure the context is READY when calling function
Protect pa_operation_sync against disconnected context

Fixes #365
This commit is contained in:
Wim Taymans 2020-11-04 19:27:17 +01:00
parent 7a43769648
commit 6444147a12
2 changed files with 52 additions and 1 deletions

View file

@ -51,7 +51,8 @@ pa_operation *pa_operation_new(pa_context *c, pa_stream *s, pa_operation_cb_t cb
int pa_operation_sync(pa_operation *o)
{
pa_context *c = o->context;
c->pending_seq = pw_core_sync(c->core, PW_ID_CORE, 0);
if (c->core != NULL)
c->pending_seq = pw_core_sync(c->core, PW_ID_CORE, 0);
o->sync = true;
pw_log_debug("operation %p: sync seq:%d", o, c->pending_seq);
return 0;