aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2018-03-14 15:17:59 -0400
committerCedric Bail <cedric@osg.samsung.com>2018-03-19 13:00:25 -0700
commit3f5ac71ad6108aec2e61d12a98f41b276415af38 (patch)
treeb57ef7cf30ce9be72963c2b4e7879a04c58f1024
parenteldbus: use efl_del when clearing the model connection child list (diff)
downloadefl-3f5ac71ad6108aec2e61d12a98f41b276415af38.tar.gz
eldbus: ensure the lifetime of the eldbus object path is monitored for proxies
the object is instantly destroyed when connection is lost Signed-off-by: Mike Blumenkrantz <zmike@osg.samsung.com>
-rw-r--r--src/lib/eldbus/eldbus_model_proxy.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/lib/eldbus/eldbus_model_proxy.c b/src/lib/eldbus/eldbus_model_proxy.c
index 3c54d22ca5..e4eeb8cc37 100644
--- a/src/lib/eldbus/eldbus_model_proxy.c
+++ b/src/lib/eldbus/eldbus_model_proxy.c
@@ -68,6 +68,14 @@ _eldbus_model_proxy_efl_object_constructor(Eo *obj, Eldbus_Model_Proxy_Data *pd)
}
static void
+_eldbus_model_proxy_object_del(void *data, Eldbus_Object *object EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Eldbus_Model_Proxy_Data *pd = data;
+
+ pd->object = NULL;
+}
+
+static void
_eldbus_model_proxy_custom_constructor(Eo *obj EINA_UNUSED,
Eldbus_Model_Proxy_Data *pd,
Eldbus_Object *object,
@@ -77,6 +85,7 @@ _eldbus_model_proxy_custom_constructor(Eo *obj EINA_UNUSED,
EINA_SAFETY_ON_NULL_RETURN(interface);
pd->object = eldbus_object_ref(object);
+ eldbus_object_event_callback_add(object, ELDBUS_OBJECT_EVENT_DEL, _eldbus_model_proxy_object_del, pd);
pd->name = eina_stringshare_add(interface->name);
pd->interface = interface;
}
@@ -89,7 +98,11 @@ _eldbus_model_proxy_efl_object_destructor(Eo *obj, Eldbus_Model_Proxy_Data *pd)
eina_hash_free(pd->properties_hash);
eina_stringshare_del(pd->name);
- eldbus_object_unref(pd->object);
+ if (pd->object)
+ {
+ eldbus_object_event_callback_del(pd->object, ELDBUS_OBJECT_EVENT_DEL, _eldbus_model_proxy_object_del, pd);
+ eldbus_object_unref(pd->object);
+ }
efl_destructor(efl_super(obj, MY_CLASS));
}