summaryrefslogtreecommitdiff
path: root/src/lib/eldbus
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 /src/lib/eldbus
parent67b135ab875a20f3320ac224790bc38baf01277a (diff)
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>
Diffstat (limited to 'src/lib/eldbus')
-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 3c54d22..e4eeb8c 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)
68} 68}
69 69
70static void 70static void
71_eldbus_model_proxy_object_del(void *data, Eldbus_Object *object EINA_UNUSED, void *event_info EINA_UNUSED)
72{
73 Eldbus_Model_Proxy_Data *pd = data;
74
75 pd->object = NULL;
76}
77
78static void
71_eldbus_model_proxy_custom_constructor(Eo *obj EINA_UNUSED, 79_eldbus_model_proxy_custom_constructor(Eo *obj EINA_UNUSED,
72 Eldbus_Model_Proxy_Data *pd, 80 Eldbus_Model_Proxy_Data *pd,
73 Eldbus_Object *object, 81 Eldbus_Object *object,
@@ -77,6 +85,7 @@ _eldbus_model_proxy_custom_constructor(Eo *obj EINA_UNUSED,
77 EINA_SAFETY_ON_NULL_RETURN(interface); 85 EINA_SAFETY_ON_NULL_RETURN(interface);
78 86
79 pd->object = eldbus_object_ref(object); 87 pd->object = eldbus_object_ref(object);
88 eldbus_object_event_callback_add(object, ELDBUS_OBJECT_EVENT_DEL, _eldbus_model_proxy_object_del, pd);
80 pd->name = eina_stringshare_add(interface->name); 89 pd->name = eina_stringshare_add(interface->name);
81 pd->interface = interface; 90 pd->interface = interface;
82} 91}
@@ -89,7 +98,11 @@ _eldbus_model_proxy_efl_object_destructor(Eo *obj, Eldbus_Model_Proxy_Data *pd)
89 eina_hash_free(pd->properties_hash); 98 eina_hash_free(pd->properties_hash);
90 99
91 eina_stringshare_del(pd->name); 100 eina_stringshare_del(pd->name);
92 eldbus_object_unref(pd->object); 101 if (pd->object)
102 {
103 eldbus_object_event_callback_del(pd->object, ELDBUS_OBJECT_EVENT_DEL, _eldbus_model_proxy_object_del, pd);
104 eldbus_object_unref(pd->object);
105 }
93 106
94 efl_destructor(efl_super(obj, MY_CLASS)); 107 efl_destructor(efl_super(obj, MY_CLASS));
95} 108}