dbus_connection_send_with_reply_and_block and errors
Timo Teräs
timo.teras at nokia.com
Wed Aug 10 02:55:59 EST 2005
ext Havoc Pennington wrote:
> On Tue, 2005-08-09 at 19:02 +0300, Timo Teräs wrote:
>>dbus_set_error() never duplicates the error.name field; it just does a
>>pointer assignment.
>
> I think this is the bug (I'm not sure why it is like this to be honest,
> seems like a pretty bad idea, though it looks like it was deliberate)
I guess in most cases the error.name is a constant and can be safely
assigned. This makes sense since it saves memory and CPU cycles. But in case
of dbus_set_error_from_message() it is just broken.
So, shall I write a patch to do duplication of .name in dbus_set_error() and
do a free() in dbus_error_free()?
Or would it make any sense to add a reference count for the message in
dbus_set_error_from_message() and release it in dbus_error_free()? This
would be a bit more CPU friendly solution. This would need changing of
DBusErrorReal: we could use the padding1 field for the DBusMessage pointer.
Cheers,
Timo
More information about the dbus
mailing list