[PATCH] similar change to dbus_connection_unregister_object_path

Havoc Pennington hp at redhat.com
Wed Oct 10 09:33:57 PDT 2007

Simon McVittie wrote:
> As per Thiago's comments, I suggest we loosen the API contract on
> dbus_connection_unregister_object_path too.

Hmm... unlike the try_register this one does have a downside: if you 
have a typo in the name of the path you unregister, you'll be silently 

btw, the warning here (and for register) was just _dbus_warn, not 
_dbus_warn_check_failed, so does not abort.

I'm trying to think about when it would be correct for a module to 
unregister without knowing it was registered. Say two modules both 
attempt to register a path. One of them fails. Then later they both 
unregister. One of them could unregister the path, even though it had 
failed to register. i.e. one could unregister the other's stuff.

It seems to me, then, that we have to say a correct module will use 
try_register_object_path to be sure it registers successfully; and then 
it will only unregister if it successfully registered.

So, a warning if it unregisters while not registered would be 
appropriate, wouldn't it?

I'm struggling to think of an example of non-broken code that 
unregisters without knowing whether it's registered. I think we need 
that example to remove the warning, otherwise we're just removing a 
helpful clue when someone is debugging their broken code.


More information about the dbus mailing list