noux: first remove from list, then dissolve

Avoids deadlock - which is out of the list can't be found twice to be deleted.

Issue #485
This commit is contained in:
Alexander Boettcher 2013-08-30 08:46:21 +02:00 committed by Norman Feske
parent 7c591a8151
commit 71aacd7ed8
4 changed files with 20 additions and 16 deletions

View File

@ -124,11 +124,7 @@ namespace Noux {
* created via 'Rm_dataspace_info::fork', are not handled by
* those destructors. So we have to clean them up here.
*/
for (;;) {
Dataspace_info *info = _pool.first();
if (!info)
return;
while(Dataspace_info *info = _pool.first()) {
_pool.remove_locked(info);
destroy(env()->heap(), info);
}
@ -172,8 +168,10 @@ namespace Noux {
return;
}
info->dissolve_users();
_ds_registry.remove(info);
info->dissolve_users();
}
Dataspace_capability fork(Ram_session_capability,

View File

@ -132,13 +132,16 @@ namespace Noux {
/* release dataspace info */
Dataspace_info *info = _ds_registry.lookup_info(ds_cap);
if (info) {
info->dissolve_users();
_ds_registry.remove(info);
destroy(env()->heap(), info);
} else {
if (!info) {
PWRN("Could not lookup dataspace info for local RM session");
return;
}
_ds_registry.remove(info);
info->dissolve_users();
destroy(env()->heap(), info);
}
};
}

View File

@ -161,9 +161,10 @@ namespace Noux {
return;
}
_registry.remove(ds_info);
ds_info->dissolve_users();
_registry.remove(ds_info);
_list.remove(ds_info);
_used_quota -= ds_info->size();

View File

@ -66,18 +66,20 @@ namespace Noux {
~Rom_session_component()
{
/*
* Lookup and lock ds info instead of directly acccessing
* Lookup and lock ds info instead of directly accessing
* the '_ds_info' member.
*/
Object_pool<Dataspace_info>::Guard
info(_ds_registry.lookup_info(_ds_info.ds_cap()));
if (info)
info->dissolve_users();
else
if (!info) {
PERR("~Rom_session_component: unexpected !info");
return;
}
_ds_registry.remove(&_ds_info);
info->dissolve_users();
}