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

igo95862 at yandex.ru igo95862 at yandex.ru
Tue Nov 10 20:30:51 UTC 2020


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.

Even passing NULL to the second parameter will corrupt callbacks.

Is this documentation issue? Is it correct to refernce the new message 
with sd_bus_process and when not touch its refrence count until the 
callback has a chance to access it? Does the callback get a new 
reference so it should unrefrence it twice?




More information about the systemd-devel mailing list