trace: disable tracing when owner disappears

* Disable trace source and release ownership on subject destruction.
* Note, since the policy module is also destroyed on descruction of the
  session component, the traced component must not access the policy
  module when acknowledging the disabled state (else: page fault).

Fixes genodelabs/genode#4247
This commit is contained in:
Johannes Schlatow
2021-08-12 16:07:13 +02:00
committed by Christian Helmuth
parent 81d939f947
commit 5e284bfb35
2 changed files with 13 additions and 6 deletions

View File

@ -189,6 +189,19 @@ class Genode::Trace::Subject
_label(label), _name(name)
{ }
/**
* Destructor, releases ownership of associated source
*/
~Subject()
{
Locked_ptr<Source> source(_source);
if (source.valid()) {
source->disable();
source->release_ownership(*this);
}
}
/**
* Return registry-local ID
*/