Remediate Phase P render-in-place review findings

Fix the ProjectMedia refusal path's false bank claims and file relocation, an unreachable-undo idiom, and eight comment/doc accuracy issues.
This commit is contained in:
2026-08-02 14:38:35 -04:00
parent 5c0f5f1591
commit d7e5c59547
9 changed files with 75 additions and 29 deletions
+15 -7
View File
@@ -2,9 +2,6 @@
//
// Includes reaper_plugin_functions.h WITHOUT REAPERAPI_IMPLEMENT — main.cpp is the
// one TU that defines the API pointers; here they are extern.
//
// Traffic is one-way: this borrows capture's render, and capture may never borrow
// this placement back.
#include "shell/capture/render_in_place.h"
@@ -121,7 +118,11 @@ void RunRenderTrackInPlace(ReaSamplerSession& session) {
const int trackCount = CountTracks(proj);
const int srcIndex = indexOfTrack(proj, trackCount, source);
if (srcIndex < 0) { refuse("the source track is no longer in the project"); return; }
if (srcIndex < 0) {
refuse("the source track is no longer in the project; the render landed at " +
res.absolutePath + " but was not placed.");
return;
}
const SiblingPlacement place =
siblingPlacement(folderDepths(proj, trackCount), srcIndex);
@@ -137,8 +138,13 @@ void RunRenderTrackInPlace(ReaSamplerSession& session) {
InsertTrackInProject(proj, place.insertIndex, /*flags=*/0);
MediaTrack* fresh = GetTrack(proj, place.insertIndex);
if (!fresh) {
Undo_EndBlock2(nullptr, "", 0);
refuse("could not create the result track");
// InsertTrackInProject already mutated the project by this point, so the
// "no ext-state write -> discard" idiom does not apply here — a discard would
// leave the orphaned track un-undoable.
Undo_EndBlock2(nullptr, "ReaSampler: render in place (failed to create result track)",
-1);
refuse("could not create the result track; the render landed at " +
res.absolutePath + " but was not placed.");
return;
}
@@ -151,7 +157,6 @@ void RunRenderTrackInPlace(ReaSamplerSession& session) {
}
SetMediaTrackInfo_Value(fresh, "I_FOLDERDEPTH",
static_cast<double>(place.newDepth));
TrackList_AdjustWindows(false);
// GetTrackColor returns the colour already OR'd with 0x1000000 and 0 for "no
// colour set", which I_CUSTOMCOLOR reads as unused — so one line clones a colour
@@ -161,6 +166,9 @@ void RunRenderTrackInPlace(ReaSamplerSession& session) {
const std::string freshName = captureTrackName(trackName(source));
setTrackName(fresh, freshName);
// After every attribute write, per the SDK header's manual-panel-update caveat.
TrackList_AdjustWindows(false);
// Unsnapped and unrounded, deliberately: this placement IS the null test performed
// automatically, so snapping it to the grid would move the audio off the position
// it was rendered from. InsertOptions{} defaults give native length and no conform.