dbus_connection_send_with_reply() shouldn't return TRUE on a disconnected connection

Havoc Pennington havoc.pennington at gmail.com
Fri Apr 17 15:05:51 PDT 2009


On Fri, Apr 17, 2009 at 5:46 PM, Lennart Poettering <mzqohf at 0pointer.de> wrote:
> Currently dbus_connection_send_with_reply() returns TRUE when it is
> tried to send a message on a disconnected connection. The only reason
> I could see for this behaviour is that the documentation claims that
> it would return FALSE only on OOM. But if you look closely you see
> that the function might return FALSE on other non-OOM causes too.

If it returns FALSE for non-OOM reasons it's a bug (ignoring
return_if_fail assertions, in those cases we're in "undefined
behavior" zone).

If we returned FALSE for non-OOM reasons we would need a DBusError
parameter to enable the caller to know if OOM occurred. Generally OOM
must be handled differently from other kinds of error.

If you want to handle all errors the same with this function, check
pending != NULL rather than the return value.

Given a do-over I might just make the function have a DBusError
parameter, but, ABI is frozen.


More information about the dbus mailing list