[pulseaudio-discuss] [PATCH 13/13] Remove refcounting from ports, sinks and sources
David Henningsson
david.henningsson at canonical.com
Thu Feb 14 06:02:50 PST 2013
On 02/12/2013 08:37 PM, Tanu Kaskinen wrote:
> since I dislike refcounting, I decided to spend
> the effort on removing the refcounting from ports instead. That
> required removing it also from sinks and sources.
>
> Ports are now owned solely by cards, except if a sink or source
> doesn't belong to a card, in which case the sink or source owns its
> ports.
I chose refcounting for this reason: It is sometimes being owned by
sinks/sources, and sometimes by cards. Therefore it seemed convenient to
have refcounting instead of the above scheme; which seems more error prone.
But, how about instead having an "void* owner" pointer in the port? Then
sink_free could just to "if (port->owner == me) port_free(port);" That
seems slightly less error prone to me.
Even if I would say that *this* problem is more about the hashmap: It
would be better to have a string-key-hashmap type that owned the memory
of the key strings rather than the current scheme, which cause quite
subtle errors, such as the one you're currently trying to correct.
--
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
More information about the pulseaudio-discuss
mailing list