public void DisposeContext(TbsContext c)
{
lock (this)
{
foreach (ObjectContext o in ContextManager.ObjectContexts)
{
if (o.Owner != c)
{
continue;
}
if (o.Loaded)
{
Tpm.FlushContext(o.TheTpmHandle);
o.Loaded = false;
}
else
{
if (o.TheSlotType == SlotType.SessionSlot)
{
// TODO: Need to flush saved sessions?
// Tpm.FlushContext(o.TheTpmHandle);
Tpm.FlushContext(o.Context.savedHandle);
}
}
}
ContextManager.RemoveAll(c);
}
}