From 0373b2bc1377ddd97b378dc286000aa9abbe5c1a Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 18 Sep 2021 22:26:00 +0100 Subject: [PATCH] Fix X parameter range; Fix UI crash on close if never idle Signed-off-by: falkTX --- dpf | 2 +- plugins/glBars/DistrhoPluginGLBars.cpp | 4 ++-- plugins/glBars/DistrhoUIGLBars.cpp | 8 +++++++- plugins/glBars/DistrhoUIGLBars.hpp | 1 + 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/dpf b/dpf index ccece16..e44a908 160000 --- a/dpf +++ b/dpf @@ -1 +1 @@ -Subproject commit ccece16081c89ead759394994f7251092938837e +Subproject commit e44a908375610d7f46b507532b4602c9f89f085a diff --git a/plugins/glBars/DistrhoPluginGLBars.cpp b/plugins/glBars/DistrhoPluginGLBars.cpp index cc9e746..c462e6c 100644 --- a/plugins/glBars/DistrhoPluginGLBars.cpp +++ b/plugins/glBars/DistrhoPluginGLBars.cpp @@ -74,8 +74,8 @@ void DistrhoPluginGLBars::initParameter(uint32_t index, Parameter& parameter) parameter.name = "X"; parameter.symbol = "x"; parameter.unit = ""; - parameter.ranges.def = -4.0f; - parameter.ranges.min = 0.0f; + parameter.ranges.def = 0.0f; + parameter.ranges.min = -4.0f; parameter.ranges.max = 4.0f; break; diff --git a/plugins/glBars/DistrhoUIGLBars.cpp b/plugins/glBars/DistrhoUIGLBars.cpp index cd7f3a6..8cb7e3e 100644 --- a/plugins/glBars/DistrhoUIGLBars.cpp +++ b/plugins/glBars/DistrhoUIGLBars.cpp @@ -26,13 +26,17 @@ START_NAMESPACE_DISTRHO // ----------------------------------------------------------------------- DistrhoUIGLBars::DistrhoUIGLBars() - : UI(512, 512) + : UI(512, 512), + fInitialized(false) { setGeometryConstraints(256, 256, true); } DistrhoUIGLBars::~DistrhoUIGLBars() { + if (! fInitialized) + return; + if (DistrhoPluginGLBars* const dspPtr = (DistrhoPluginGLBars*)getPluginInstancePointer()) { const MutexLocker csm(dspPtr->fMutex); @@ -81,6 +85,8 @@ void DistrhoUIGLBars::uiIdle() if (dspPtr->fState != nullptr) return; + fInitialized = true; + const MutexLocker csm(dspPtr->fMutex); dspPtr->fState = &fState; } diff --git a/plugins/glBars/DistrhoUIGLBars.hpp b/plugins/glBars/DistrhoUIGLBars.hpp index 997522b..953ad88 100644 --- a/plugins/glBars/DistrhoUIGLBars.hpp +++ b/plugins/glBars/DistrhoUIGLBars.hpp @@ -53,6 +53,7 @@ protected: bool onKeyboard(const KeyboardEvent&) override; private: + bool fInitialized; glBarsState fState; DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoUIGLBars)