I don’t think it’s strictly necessary, but we get rid of the transport before closing the edit.
void deleteEdit()
{
if (transport != nullptr)
{
transport->freePlaybackContext();
transport = nullptr;
}
previewEdit = nullptr;
}
Getting rid of your UI first is good. You don’t want anything hanging onto a reference counted clip, track, plugin etc hanging around, since they’ll still exist but their parent edit will be gone, which could lead to trouble.
I advise to holding onto pointers from the engine as little as possible. Try and just make ValueTree objects and watch them for changes if possible.