proxy: invalidate proxy id when removed from map

Client-side bugs calling methods on destroyed proxies like

    pw_proxy_ref(p);
    pw_proxy_destroy(p);
    ...
    wait for server to ack the remove
    ...
    pw_core_destroy(p->core, p); /* p already removed & destroyed */

should not send messages with the stale proxy id to server.

Set id to SPA_ID_INVALID when removing a proxy from the id map, so that
such client bugs only result to ENOENT.
This commit is contained in:
Pauli Virtanen 2024-10-23 18:45:47 +03:00 committed by Wim Taymans
parent 24e1603f81
commit 7f885a2e94

View file

@ -191,6 +191,9 @@ static inline void remove_from_map(struct pw_proxy *proxy)
if (proxy->core) if (proxy->core)
pw_map_remove(&proxy->core->objects, proxy->id); pw_map_remove(&proxy->core->objects, proxy->id);
proxy->in_map = false; proxy->in_map = false;
/* Make sure any future method calls fail */
proxy->id = SPA_ID_INVALID;
} }
} }