dbus_connection_send_with_reply_and_block and errors
Colin Walters
walters at verbum.org
Wed Aug 10 03:43:36 EST 2005
On Tue, 2005-08-09 at 19:55 +0300, Timo Teräs wrote:
> 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()?
Hm...doesn't this make OOM handling significantly more complicated if
setting an error can require memory allocation?
Perhaps instead of the reference counting (which sounds complicated) we
could simply to add a "dbus_bool_t free_name" member;
dbus_set_error_from_message sets this (and dups the name), and
dbus_error_free frees the name if it's set. Wouldn't that work?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/dbus/attachments/20050809/4b18eac0/attachment.pgp
More information about the dbus
mailing list