[systemd-devel] sd_bus. Message refrence count between sd_bus_call_async callback and sd_bus_process.

Lennart Poettering lennart at poettering.net
Sat Dec 19 10:58:01 UTC 2020


On Di, 10.11.20 23:30, igo95862 at yandex.ru (igo95862 at yandex.ru) wrote:

> Calling sd_bus_process with second parameter as sd_bus_message** will put a
> new message in to that pointer. The man page says that the caller should
> unref it ,however, I found out that if you do that it will get garbage
> collected before a callback registed with sd_bus_call_async will get a
> chance to access it.

sd_bus_call_async() should be dispatched before sd_bus_process()'
second param returns it. Maybe you callback handler doesn't properly
ref count the passed message if it wants to keep a ref?

Please provide a minimal example where the issue is supposed to show.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list