[systemd-devel] refcount of bus returned from sd_bus_default_system

Stanislav Angelovič angelovic.s at gmail.com
Wed May 8 20:50:12 UTC 2019


Heya,

when writing sdbus-c++, we've observed that sd_bus_default_system function
called in a fresh new thread returns a bus with initial ref count 2. We
built our code upon that assumption -- we had to unref the bus twice when
the thread local storage got freed, otherwise we'd have gotten memory leaks.

Now it broke, however, because in systemd v242, the initial ref count is 1.
Is that a conscious change? Can we build upon the guarantee that it will
always be 1? (1 actually seems reasonable, unlike 2).

Thanks,

Stan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20190508/a7c32d41/attachment.html>


More information about the systemd-devel mailing list