diff options
author | Wim Taymans <wtaymans@redhat.com> | 2019-08-16 15:19:19 +0200 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2019-08-16 15:19:19 +0200 |
commit | 84ec90da2d211672dd4c6b6a0cde1a2ba70276d4 (patch) | |
tree | 9e5dbc6fc439bd9154a8ffaa5324901bb32d7def /src/modules | |
parent | 58fd46ebd10c995394c1f6f42c815f25ff21a15e (diff) |
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.
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/module-protocol-native.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/modules/module-protocol-native.c b/src/modules/module-protocol-native.c index 228af759..af6a4c23 100644 --- a/src/modules/module-protocol-native.c +++ b/src/modules/module-protocol-native.c @@ -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; |