proxy: never free a proxy automatically

Never free a proxy without the application doing a pw_proxy_destroy.

It's hard to use when proxies are freed randomly when the server
removes the ids. You have to add destroy notify to all proxies and
deal with the arbirary order in which proxies can be freed.
Instead notify the client of the remove and let it destroy the
proxies itself in the right order. This is in line with how wayland
handles proxies.

A pw_proxy_destroy() will now send a destroy to the server and mark
the proxy as a zombie, waiting for the remove_id confirmation and
then destroy the proxy.

A server remove_id will mark the proxy as removed and emits the
removed event. The app should then pw_proxy_destroy the proxy
to free it.

Leaks all proxies in the session manager because cleanup now needs
to be handled by the app correctly.
This commit is contained in:
Wim Taymans 2019-12-19 13:39:05 +01:00
parent f391353c7f
commit d3db9d12bc
5 changed files with 67 additions and 27 deletions

View file

@ -724,6 +724,7 @@ struct pw_resource {
#define pw_proxy_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_proxy_events, m, v, ##__VA_ARGS__)
#define pw_proxy_emit_destroy(p) pw_proxy_emit(p, destroy, 0)
#define pw_proxy_emit_bound(p,g) pw_proxy_emit(p, bound, 0, g)
#define pw_proxy_emit_removed(p) pw_proxy_emit(p, removed, 0)
#define pw_proxy_emit_done(p,s) pw_proxy_emit(p, done, 0, s)
#define pw_proxy_emit_error(p,s,r,m) pw_proxy_emit(p, error, 0, s, r, m)