fix(persist): call MarkProjectDirty after every SetProjExtState write
After capture, saveToActiveProject wrote ext state but left the project clean, so Ctrl+S was a no-op and the bank was silently lost on close. Also flushes the Save-As re-GUID on the normal save flow.
This commit is contained in:
+5
-1
@@ -54,6 +54,7 @@
|
||||
#define REAPERAPI_MINIMAL
|
||||
#define REAPERAPI_WANT_EnumProjects
|
||||
#define REAPERAPI_WANT_GetProjExtState
|
||||
#define REAPERAPI_WANT_MarkProjectDirty
|
||||
#define REAPERAPI_WANT_SetProjExtState
|
||||
#define REAPERAPI_WANT_ShowConsoleMsg
|
||||
#define REAPERAPI_WANT_genGuid
|
||||
@@ -162,6 +163,7 @@ void ReaSamplerSession::saveToActiveProject() {
|
||||
const std::string json = bank_.serialize();
|
||||
SetProjExtState(static_cast<ReaProject*>(proj), kProjExtNamespace,
|
||||
kProjExtIndexKey, json.c_str());
|
||||
MarkProjectDirty(static_cast<ReaProject*>(proj));
|
||||
}
|
||||
|
||||
void ReaSamplerSession::loadFromProject(void* proj, const std::string& projectDir) {
|
||||
@@ -266,11 +268,13 @@ void ReaSamplerSession::poll() {
|
||||
// Save-As duplicated our ext state, so the new project B currently
|
||||
// shares A's GUID. Mint a FRESH GUID for B and write it, so A and B
|
||||
// no longer collide on identity when reopened later. Adopt the fresh
|
||||
// GUID as our last-seen identity.
|
||||
// GUID as our last-seen identity. Mark dirty so the fresh GUID flushes
|
||||
// to the new .rpp on the next normal save / close-prompt.
|
||||
const std::string fresh = genProjectGuidString();
|
||||
if (proj) {
|
||||
SetProjExtState(static_cast<ReaProject*>(proj), kProjExtNamespace,
|
||||
kProjExtGuidKey, fresh.c_str());
|
||||
MarkProjectDirty(static_cast<ReaProject*>(proj));
|
||||
}
|
||||
lastGuid_ = fresh;
|
||||
lastRppPath_ = rppPath;
|
||||
|
||||
Reference in New Issue
Block a user