[PATCH] similar change to dbus_connection_unregister_object_path
Simon McVittie
simon.mcvittie at collabora.co.uk
Wed Oct 10 05:42:52 PDT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
As per Thiago's comments, I suggest we loosen the API contract on
dbus_connection_unregister_object_path too.
- From 9255fac48b6b042fbe537cd4a62168fb017f34ba Mon Sep 17 00:00:00 2001
From: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Wed, 10 Oct 2007 13:01:37 +0100
Subject: [PATCH] dbus_connection_unregister_object_path: Don't consider it to be a bug to unregister already-unregistered object paths.
- ---
dbus/dbus-connection.c | 5 ++++-
dbus/dbus-object-tree.c | 12 +++---------
2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c
index e6848c1..d0a0863 100644
- --- a/dbus/dbus-connection.c
+++ b/dbus/dbus-connection.c
@@ -5459,9 +5459,12 @@ dbus_connection_register_fallback (DBusConnection *connection,
/**
* Unregisters the handler registered with exactly the given path.
- - * It's a bug to call this function for a path that isn't registered.
+ * Calling this function for a path that isn't registered has no effect.
* Can unregister both fallback paths and object paths.
*
+ * @note In libdbus <= 1.1.2 it was considered to be a bug to unregister
+ * object paths that were not already registered.
+ *
* @param connection the connection
* @param path a '/' delimited string of path elements
* @returns #FALSE if not enough memory
diff --git a/dbus/dbus-object-tree.c b/dbus/dbus-object-tree.c
index 953aa3b..b079112 100644
- --- a/dbus/dbus-object-tree.c
+++ b/dbus/dbus-object-tree.c
@@ -433,7 +433,7 @@ _dbus_object_tree_register (DBusObjectTree *tree,
/**
* Unregisters an object subtree that was registered with the
- - * same path.
+ * same path, if any.
*
* @param tree the global object tree
* @param path path to the subtree (same as the one passed to _dbus_object_tree_register())
@@ -455,17 +455,11 @@ _dbus_object_tree_unregister_and_unlock (DBusObjectTree *tree,
subtree = find_subtree (tree, path, &i);
- -#ifndef DBUS_DISABLE_CHECKS
if (subtree == NULL)
{
- - _dbus_warn ("Attempted to unregister path (path[0] = %s path[1] = %s) which isn't registered\n",
- - path[0] ? path[0] : "null",
- - path[1] ? path[1] : "null");
- - goto unlock;
+ /* there was nothing registered */
+ goto unlock;
}
- -#else
- - _dbus_assert (subtree != NULL);
- -#endif
_dbus_assert (subtree->parent == NULL ||
(i >= 0 && subtree->parent->subtrees[i] == subtree));
- --
1.5.3.4
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: OpenPGP key: http://www.pseudorandom.co.uk/2003/contact/ or pgp.net
iD8DBQFHDMjMWSc8zVUw7HYRAlAWAJ0Zo7M7JCbtCBSwScTy2ELSxWwlGgCeIl34
RSzZl4wBQMMzee5e+1W9A44=
=A4ia
-----END PGP SIGNATURE-----
More information about the dbus
mailing list