edbus: fix attaching object manager if user registered it himself

SVN revision: 82905
This commit is contained in:
Lucas De Marchi 2013-01-16 21:17:57 +00:00
parent ba3be672de
commit 3c308503ea
2 changed files with 23 additions and 22 deletions

View File

@ -149,8 +149,9 @@ struct _EDBus_Service_Object
Eina_Inlist *data;
EDBus_Service_Object *parent;
Eina_Inlist *children;
//ObjectManager data
Eina_Bool has_objectmanager:1;
EDBus_Service_Interface *objmanager;
Eina_List *iface_added;
Eina_List *iface_removed;
Ecore_Idler *idler_iface_changed;

View File

@ -506,7 +506,7 @@ _managed_obj_append(EDBus_Service_Object *obj, EDBus_Message_Iter *array, Eina_B
EDBus_Service_Object *children;
if (first) goto foreach;
if (obj->has_objectmanager) return EINA_TRUE;
if (obj->objmanager) return EINA_TRUE;
edbus_message_iter_arguments_append(array, "{oa{sa{sv}}}", &obj_entry);
edbus_message_iter_arguments_append(obj_entry, "oa{sa{sv}}", obj->path,
@ -767,7 +767,7 @@ _object_manager_parent_find(EDBus_Service_Object *obj)
{
if (!obj->parent)
return NULL;
if (obj->parent->has_objectmanager)
if (obj->parent->objmanager)
return obj->parent;
return _object_manager_parent_find(obj->parent);
}
@ -1413,27 +1413,27 @@ edbus_service_object_manager_attach(EDBus_Service_Interface *iface)
obj = iface->obj;
/* We already have it and we registered it ourselves */
if (obj->objmanager)
return EINA_TRUE;
/* Ugh. User already registered the ObjectManager interface himself? */
if (eina_hash_find(obj->interfaces, obj->objmanager->name))
return EINA_FALSE;
if (!eina_hash_add(obj->interfaces, objmanager->name, objmanager))
return EINA_FALSE;
/*
* FIXME: if the user registered an ObjectManager interface himself, this is
* utterly wrong since edbus would think it would have to send the signals,
* when the user is expected to so, since he registered the interface.
* Flush the iface_added and iface_removed, otherwise it could be sent
* with path equal to our path rather than from the previous
* ObjectManager
*/
if (!eina_hash_find(obj->interfaces, objmanager->name))
{
if (!eina_hash_add(obj->interfaces, objmanager->name, objmanager))
return EINA_FALSE;
if (obj->idler_iface_changed)
ecore_idler_del(obj->idler_iface_changed);
_object_manager_changes_process(obj);
/*
* Flush the iface_added and iface_removed, otherwise it could be sent
* with path equal to our path rather than from the previous
* ObjectManager
*/
if (obj->idler_iface_changed)
ecore_idler_del(obj->idler_iface_changed);
_object_manager_changes_process(obj);
}
obj->has_objectmanager = EINA_TRUE;
obj->objmanager = objmanager;
obj->introspection_dirty = EINA_TRUE;
return EINA_TRUE;
}
@ -1453,7 +1453,7 @@ edbus_service_object_manager_detach(EDBus_Service_Interface *iface)
_object_manager_changes_process(obj);
ret = eina_hash_del(obj->interfaces, objmanager->name, NULL);
obj->has_objectmanager = EINA_FALSE;
obj->objmanager = NULL;
obj->introspection_dirty = EINA_TRUE;
//properties + introspectable
if (eina_hash_population(iface->obj->interfaces) < 3)