DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit e623a70ac8313de9c8a48eba56b7d1c0aca35058
parent caa0fc9b70efbf6fd4fc16f027914e8dd2f76f27
Author: falkTX <falktx@falktx.com>
Date:   Mon, 28 Mar 2022 20:40:34 +0100

VST3: fix controller state never updated when separate

Signed-off-by: falkTX <falktx@falktx.com>

Diffstat:
Mdistrho/src/DistrhoPluginVST3.cpp | 8+++++++-
Mdistrho/src/DistrhoUIVST3.cpp | 4++--
2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/distrho/src/DistrhoPluginVST3.cpp b/distrho/src/DistrhoPluginVST3.cpp @@ -2056,11 +2056,17 @@ public: #if DISTRHO_PLUGIN_WANT_STATE if (std::strcmp(msgid, "state-set") == 0) { + const v3_result res = notify_state(attrs); + #if DPF_VST3_USES_SEPARATE_CONTROLLER + if (res != V3_OK) + return res; + + // notify component of the change DISTRHO_SAFE_ASSERT_RETURN(fConnectionFromCompToCtrl != nullptr, V3_INTERNAL_ERR); return v3_cpp_obj(fConnectionFromCompToCtrl)->notify(fConnectionFromCompToCtrl, message); #else - return notify_state(attrs); + return res; #endif } #endif diff --git a/distrho/src/DistrhoUIVST3.cpp b/distrho/src/DistrhoUIVST3.cpp @@ -160,8 +160,8 @@ public: ); char suffix[9]; - std::snprintf(suffix, 8, "%08x", std::rand()); - suffix[8] = '\0'; + std::snprintf(suffix, sizeof(suffix), "%08x", std::rand()); + suffix[sizeof(suffix)-1] = '\0'; fTimerWindowClassName += suffix; WNDCLASSEX cls;