[PATCH 1/2] dbus: Call destroy function in l_dbus_remove_watch
by Andrew Zaborowski
l_dbus_remove_watch (_dbus_name_cache_remove_watch) marks name watches
as removed and schedules a service_watch_remove_all call. Do the
watch's destroy callback when marking the watch as removed instead of
waiting until the service_watch_remove_all idle callback to do this.
Semantically it may be ok to do the destroy callback later but I think
it's easier on the user if they can be sure they'll get no more
callbacks after using l_dbus_remove_watch.
---
ell/dbus-name-cache.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/ell/dbus-name-cache.c b/ell/dbus-name-cache.c
index cb6a516..b09cc97 100644
--- a/ell/dbus-name-cache.c
+++ b/ell/dbus-name-cache.c
@@ -283,6 +283,12 @@ static void service_watch_mark(const void *key, void *value, void *user_data)
watch->removed = true;
watch->connect_func = NULL;
watch->disconnect_func = NULL;
+
+ if (watch->destroy) {
+ watch->destroy(watch->user_data);
+ watch->destroy = NULL;
+ }
+
*id = 0;
break;
}
--
2.25.1
10 months