temporal: fix up some logic relating to scoped tempo maps

This commit is contained in:
Paul Davis 2025-08-11 15:41:03 -06:00
parent 023290b99d
commit dd41fddcad
3 changed files with 15 additions and 4 deletions

View file

@ -859,6 +859,12 @@ TempoMap::set_scope_owner (ScopedTempoMapOwner& sco)
_scope_owner = &sco;
}
void
TempoMap::clear_scope_owner ()
{
_scope_owner = nullptr;
}
TempoMap&
TempoMap::operator= (TempoMap const & other)
{

View file

@ -35,16 +35,20 @@ class ScopedTempoMapOwner
virtual ~ScopedTempoMapOwner () {}
void start_local_tempo_map (std::shared_ptr<Temporal::TempoMap> map) {
_local_tempo_map = map;
in ();
DEBUG_TRACE (PBD::DEBUG::ScopedTempoMap, string_compose ("%1: starting local tempo scope\n", scope_name()));
map->set_scope_owner (*this);
_local_tempo_map = map;
Temporal::TempoMap::set (_local_tempo_map);
local_tempo_map_depth = 1;
}
void end_local_tempo_map () {
DEBUG_TRACE (PBD::DEBUG::ScopedTempoMap, string_compose ("%1: ending local tempo scope\n", scope_name()));
local_tempo_map_depth = 1; /* force exit in out() */
out ();
assert (_local_tempo_map);
local_tempo_map_depth = 0;
_local_tempo_map->clear_scope_owner ();
_local_tempo_map.reset ();
Temporal::TempoMap::fetch ();
}
uint64_t depth() const { return local_tempo_map_depth; }

View file

@ -1011,6 +1011,7 @@ class /*LIBTEMPORAL_API*/ TempoMap : public PBD::StatefulDestructible
static void map_assert (bool expr, char const * exprstr, char const * file, int line);
void set_scope_owner (ScopedTempoMapOwner&);
void clear_scope_owner ();
ScopedTempoMapOwner* scope_owner() const { return _scope_owner; }
private: