summaryrefslogtreecommitdiff
path: root/src/lib/eldbus/eldbus_service.c
diff options
context:
space:
mode:
authorJosé Roberto de Souza <jose.souza@intel.com>2013-08-26 14:57:27 -0300
committerJosé Roberto de Souza <jose.souza@intel.com>2013-08-26 15:17:02 -0300
commit547313ece9db920a2a03cad5e29a6503ab3c611a (patch)
tree8cc365ff0c9fb0a0fda3d47f8a674d6745366ed5 /src/lib/eldbus/eldbus_service.c
parent74bf97600fd42c40992c4b89af0ceaf9682f426b (diff)
eldbus: Send all object manager signals of all childrens before delete path or detach object manager
Diffstat (limited to 'src/lib/eldbus/eldbus_service.c')
-rw-r--r--src/lib/eldbus/eldbus_service.c60
1 files changed, 51 insertions, 9 deletions
diff --git a/src/lib/eldbus/eldbus_service.c b/src/lib/eldbus/eldbus_service.c
index 8c44e8107d..490b045b1a 100644
--- a/src/lib/eldbus/eldbus_service.c
+++ b/src/lib/eldbus/eldbus_service.c
@@ -1136,23 +1136,60 @@ _interface_free(Eldbus_Service_Interface *interface)
1136 free(interface); 1136 free(interface);
1137} 1137}
1138 1138
1139static void _children_ifaces_add_removed_flush(Eldbus_Service_Object *obj)
1140{
1141 Eldbus_Service_Object *children;
1142
1143 EINA_INLIST_FOREACH(obj->children, children)
1144 {
1145 /**
1146 * if there a object manager in some child
1147 * that object manager is responsible for they
1148 * children objects
1149 */
1150 if (!obj->objmanager)
1151 _children_ifaces_add_removed_flush(children);
1152 }
1153
1154 if (obj->idler_iface_changed)
1155 {
1156 ecore_idler_del(obj->idler_iface_changed);
1157 _object_manager_changes_process(obj);
1158 }
1159}
1160
1139static void 1161static void
1140_object_free(Eldbus_Service_Object *obj) 1162_object_free(Eldbus_Service_Object *obj)
1141{ 1163{
1142 Eina_Iterator *iterator; 1164 Eina_Iterator *iterator;
1143 Eldbus_Service_Interface *iface; 1165 Eldbus_Service_Interface *iface;
1144 1166
1145 /* Flush ObjectManager interface before the entire object goes away */ 1167 if (obj->objmanager)
1146 if (obj->idler_iface_changed)
1147 { 1168 {
1148 ecore_idler_del(obj->idler_iface_changed); 1169 Eldbus_Service_Object *children;
1149 _object_manager_changes_process(obj); 1170
1171 /**
1172 * Flush the iface_add/removed of all children objects
1173 * that this object is the ObjectManager
1174 */
1175 EINA_INLIST_FOREACH(obj->children, children)
1176 _children_ifaces_add_removed_flush(children);
1150 } 1177 }
1151 1178
1152 iterator = eina_hash_iterator_data_new(obj->interfaces); 1179 iterator = eina_hash_iterator_data_new(obj->interfaces);
1153 EINA_ITERATOR_FOREACH(iterator, iface) 1180 EINA_ITERATOR_FOREACH(iterator, iface)
1154 _interface_free(iface); 1181 _interface_free(iface);
1155 1182
1183 /**
1184 * Flush our iface_add/removed if this object are
1185 * children of some other path with ObjectManager
1186 */
1187 if (obj->idler_iface_changed)
1188 {
1189 ecore_idler_del(obj->idler_iface_changed);
1190 _object_manager_changes_process(obj);
1191 }
1192
1156 while (obj->children) 1193 while (obj->children)
1157 { 1194 {
1158 Eldbus_Service_Object *child; 1195 Eldbus_Service_Object *child;
@@ -1171,6 +1208,7 @@ _object_free(Eldbus_Service_Object *obj)
1171 child->parent = NULL; 1208 child->parent = NULL;
1172 } 1209 }
1173 } 1210 }
1211
1174 if (obj->parent) 1212 if (obj->parent)
1175 obj->parent->children = eina_inlist_remove(obj->parent->children, 1213 obj->parent->children = eina_inlist_remove(obj->parent->children,
1176 EINA_INLIST_GET(obj)); 1214 EINA_INLIST_GET(obj));
@@ -1458,16 +1496,20 @@ eldbus_service_object_manager_attach(Eldbus_Service_Interface *iface)
1458EAPI Eina_Bool 1496EAPI Eina_Bool
1459eldbus_service_object_manager_detach(Eldbus_Service_Interface *iface) 1497eldbus_service_object_manager_detach(Eldbus_Service_Interface *iface)
1460{ 1498{
1461 Eldbus_Service_Object *obj; 1499 Eldbus_Service_Object *obj, *children;
1462 Eina_Bool ret; 1500 Eina_Bool ret;
1463 1501
1464 ELDBUS_SERVICE_INTERFACE_CHECK_RETVAL(iface, EINA_FALSE); 1502 ELDBUS_SERVICE_INTERFACE_CHECK_RETVAL(iface, EINA_FALSE);
1465 obj = iface->obj; 1503 obj = iface->obj;
1504 if (!obj->objmanager)
1505 return EINA_TRUE;
1466 1506
1467 /* Flush our iface_added/iface_removed before our ObjectManager goes away */ 1507 /**
1468 if (obj->idler_iface_changed) 1508 * Flush the iface_add/removed of all children objects
1469 ecore_idler_del(obj->idler_iface_changed); 1509 * that this object is the ObjectManager
1470 _object_manager_changes_process(obj); 1510 */
1511 EINA_INLIST_FOREACH(obj->children, children)
1512 _children_ifaces_add_removed_flush(children);
1471 1513
1472 ret = eina_hash_del(obj->interfaces, objmanager->name, NULL); 1514 ret = eina_hash_del(obj->interfaces, objmanager->name, NULL);
1473 obj->objmanager = NULL; 1515 obj->objmanager = NULL;