Add temporary undo-span tracing for the mid-drain Ctrl-Z bug

One switch (REASAMPLER_UNDO_TRACE) gates every line. Traces span open/close
reasons, FX writes, UndoBlock depth, timer standoffs, and load-state hooks.
This commit is contained in:
2026-08-09 12:28:50 -04:00
parent d5ff476a19
commit b782fb2731
8 changed files with 167 additions and 21 deletions
+5 -1
View File
@@ -5,6 +5,7 @@
#include <utility>
#include "shell/undo/undo_trace.h" // TEMPORARY — see undo_trace.h; revert together
#include "shell/view/fx_reclaim.h" // fxReclaimEndUndoSpan — the span this must not nest over
#define REAPERAPI_MINIMAL
@@ -40,12 +41,13 @@ UndoBlock::UndoBlock(ReaProject* proj) : project_(proj) {
// outermost. Roll the depth back on any throw so the type degrades to "this one
// block failed to open," not "every block after it is now poisoned."
try {
if (g_depth++ == 0) fxReclaimEndUndoSpan();
if (g_depth++ == 0) fxReclaimEndUndoSpan("UndoBlock ctor");
Undo_BeginBlock2(proj);
} catch (...) {
--g_depth;
throw;
}
REASAMPLER_TRACE("[UndoBlock] CTOR proj=%s depth=%d", proj ? "real" : "active", g_depth);
}
UndoBlock::~UndoBlock() {
@@ -63,6 +65,8 @@ UndoBlock::~UndoBlock() {
if (!project_ || ValidatePtr2(nullptr, project_, "ReaProject*"))
Undo_EndBlock2(project_, label_.c_str(), mask_);
--g_depth;
REASAMPLER_TRACE("[UndoBlock] DTOR label=\"%s\" mask=%d depth=%d",
label_.empty() ? "(discard)" : label_.c_str(), mask_, g_depth);
}
void UndoBlock::recordPoint(std::string label, int mask) {