Fiasco.OC: only access valid UTCB (fix #547)

If no platform thread was created before somebody destroys a thread object,
there is no valid UTCB available. Thereby, we've to check this before accessing
the UTCB when destroying a thread object.
This commit is contained in:
Stefan Kalkowski 2012-12-03 16:30:56 +01:00 committed by Norman Feske
parent bec35bb4b1
commit bc38a13353
1 changed files with 5 additions and 3 deletions

View File

@ -29,9 +29,11 @@ void Thread_base::_deinit_platform_thread()
{
using namespace Fiasco;
Cap_index *i = (Cap_index*)l4_utcb_tcr_u(_context->utcb)->user[UTCB_TCR_BADGE];
cap_map()->remove(i);
env()->cpu_session()->kill_thread(_thread_cap);
if (_context->utcb && _thread_cap.valid()) {
Cap_index *i = (Cap_index*)l4_utcb_tcr_u(_context->utcb)->user[UTCB_TCR_BADGE];
cap_map()->remove(i);
env()->cpu_session()->kill_thread(_thread_cap);
}
}