fix(instrument_drop_win): make performInstrumentDrop all-or-nothing
On chunk-write failure, call TrackFX_Delete(track, fxIndex) to remove the just-added empty FX instance before returning false. Signature verified at reaper_plugin_functions.h:7236. Update the header comment from "leaves at most the added FX" to the new all-or-nothing contract.
This commit is contained in:
@@ -47,10 +47,11 @@ FxDropTarget resolveFxDropTarget(int screenX, int screenY);
|
||||
// (the instrument_drop::buildInstrumentDropChunk output) as its component state so it plays
|
||||
// the dragged capture. `chunkBase64` is the base64 vst_chunk. Wraps the add + inject in one
|
||||
// REAPER undo block (mirrors the bank-verb undo discipline). Returns true on success (the FX
|
||||
// was added and the chunk written), false on any failure (add returned -1, or the chunk write
|
||||
// was rejected). A false return leaves at most the added FX (no partial-state confusion — the
|
||||
// caller surfaces nothing; a failed add is visible by nothing happening). NEVER inserts a
|
||||
// timeline item; the ONLY mutations are the FX instance + its state, both undoable.
|
||||
// was added and the chunk written), false on any failure. All-or-nothing: if the chunk write
|
||||
// fails after a successful add, the freshly-added FX instance is removed via TrackFX_Delete
|
||||
// before returning false, leaving the track exactly as it was (no orphaned empty-state FX).
|
||||
// NEVER inserts a timeline item; the ONLY mutations are the FX instance + its state, both
|
||||
// undoable.
|
||||
bool performInstrumentDrop(MediaTrack* track, const std::string& chunkBase64);
|
||||
|
||||
} // namespace reasampler
|
||||
|
||||
Reference in New Issue
Block a user