mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 13:47:56 +00:00
parent
9402261dda
commit
795375796f
@ -815,12 +815,26 @@ class Nitpicker::Session_component : public Genode::Rpc_object<Session>,
|
||||
|
||||
void destroy_view(View_handle handle) override
|
||||
{
|
||||
try {
|
||||
Locked_ptr<View> view(_view_handle_registry.lookup(handle));
|
||||
if (view.is_valid())
|
||||
_destroy_view(*view);
|
||||
/*
|
||||
* Search view object given the handle
|
||||
*
|
||||
* We cannot look up the view directly from the
|
||||
* '_view_handle_registry' because we would obtain a weak
|
||||
* pointer to the view object. If we called the object's
|
||||
* destructor from the corresponding locked pointer, the
|
||||
* call of 'lock_for_destruction' in the view's destructor
|
||||
* would attempt to take the lock again.
|
||||
*/
|
||||
for (Session_view_list_elem *v = _view_list.first(); v; v = v->next()) {
|
||||
|
||||
try {
|
||||
View &view = *static_cast<View *>(v);
|
||||
if (_view_handle_registry.has_handle(view, handle)) {
|
||||
_destroy_view(view);
|
||||
break;
|
||||
}
|
||||
} catch (View_handle_registry::Lookup_failed) { }
|
||||
}
|
||||
catch (View_handle_registry::Lookup_failed) { }
|
||||
|
||||
_view_handle_registry.free(handle);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user