Re: [Dbus-cxx-devel] dbus-cxx 0.6.0 released
Status: Beta
Brought to you by:
rvinyard
From: Rick L. V. Jr. <rvi...@cs...> - 2010-01-26 15:45:09
|
Oliver Kowalke wrote: > May I ask you for what reasons yout throw exceptions as smart-pointers? > > thx and best regards, > Oliver > Hello, The dbus-cxx class DBus::Error wraps the dbus C struct DBusError. The constructor takes care of calling dbus_error_init() and the destructor takes care of dbus_error_free(). The problem with the previous implementation is that there was no reference counting to the underlying C object, so a copy of DBus::Error resulted in a premature dbus_error_free() of the underlying C object because DBus::Error doesn't have a reference counting mechanism (neither does DBusError). The alternatives would be to add a reference counting mechanism to DBus::Error (fairly trivial) or use the smart pointer's reference mechanism. I chose the latter because all the other classes in dbus-cxx should have protected constructors with static public create() methods. This brings DBus::Error in line with the others syntactically and uses a standardized reference counting mechanism. --- Rick |