I started playing around with the Tracktion engine where I moved RecordingDemo.h into a new project. While doing so I ran into a crash in tracktion_EditSnapshot.cpp in EditSnapshot::refresh():
void EditSnapshot::refresh()
{
clear();
auto pi = engine.getProjectManager().getProjectItem (sourceFile);
if (pi)
{
project = pi->getProject();
sourceFile = pi->getSourceFile();
}
auto newState = loadValueTree (sourceFile, true);
if (! newState.hasType (IDs::EDIT))
return;
name = pi ? pi->getName() : sourceFile.getFileNameWithoutExtension();
setState (newState, TimeDuration::fromSeconds (pi->getLength()));
refreshFromState();
}
pi is checked for nullptr in this method except in the setState line where it crashes in my case. Changing it to
setState (newState, TimeDuration::fromSeconds (pi == nullptr ? 0.:pi->getLength() ));
fixes the crash but I’m not sure whether there might be some better approach.