proxy: add refcount to keep the proxy alive in demarshal

We need to keep the proxy alive during demarshal because the callbacks
might decide to destroy the proxy.
This commit is contained in:
Wim Taymans 2019-08-16 15:19:19 +02:00
parent 58fd46ebd1
commit 84ec90da2d
3 changed files with 21 additions and 4 deletions

View file

@ -557,7 +557,11 @@ on_remote_data(void *data, int fd, uint32_t mask)
this, msg->opcode, msg->id);
continue;
}
if (demarshal[msg->opcode].func(proxy, msg) < 0) {
proxy->refcount++;
res = demarshal[msg->opcode].func(proxy, msg);
pw_proxy_unref(proxy);
if (res < 0) {
pw_log_error (NAME" %p: invalid message received %u for %u",
this, msg->opcode, msg->id);
continue;