From 77f532bf179389856d0c4ef978bc3fc0afd0272a Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Thu, 18 Mar 2021 20:55:38 +0100 Subject: [PATCH] Fix a memory corruption in the editor --- plugins/editor/src/editor/GUIPiano.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/editor/src/editor/GUIPiano.cpp b/plugins/editor/src/editor/GUIPiano.cpp index ef82e5de..a2614a06 100644 --- a/plugins/editor/src/editor/GUIPiano.cpp +++ b/plugins/editor/src/editor/GUIPiano.cpp @@ -19,7 +19,7 @@ static constexpr bool black[12] = {0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0}; struct SPiano::Impl { unsigned octs_ {}; - std::vector keyval_; + std::unique_ptr keyval_ { new float[128]{} }; std::bitset<128> keyUsed_; std::bitset<128> keyswitchUsed_; unsigned mousePressedKey_ = ~0u; @@ -76,7 +76,6 @@ unsigned SPiano::getNumOctaves() const void SPiano::setNumOctaves(unsigned octs) { Impl& impl = *impl_; - impl.keyval_.resize(octs * 12); impl.octs_ = std::max(1u, octs); getDimensions(true); invalid();