From a47448bab084afbe9831013d98ecf543a1a412ff Mon Sep 17 00:00:00 2001 From: xenakios Date: Sun, 8 Jul 2018 23:10:15 +0300 Subject: [PATCH] Use ScopedLock in a few places --- Source/envelope_component.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Source/envelope_component.cpp b/Source/envelope_component.cpp index ee6a70f..488817e 100644 --- a/Source/envelope_component.cpp +++ b/Source/envelope_component.cpp @@ -232,9 +232,8 @@ void EnvelopeComponent::mouseDown(const MouseEvent & ev) int r = menu.show(); if (r == 1) { - m_cs->enter(); + ScopedLock locker(*m_cs); m_envelope->ResetEnvelope(); - m_cs->exit(); } if (r == 2) { @@ -374,15 +373,14 @@ bool EnvelopeComponent::keyPressed(const KeyPress & ev) if (ev == KeyPress::deleteKey) { m_node_to_drag = -1; - //m_envelope->ClearAllNodes(); - m_cs->enter(); - m_envelope->removePointsConditionally([](const envelope_node& pt) { return pt.Status == 1; }); - if (m_envelope->GetNumNodes()==0) - m_envelope->AddNode({ 0.0,0.5 }); - m_cs->exit(); + { + ScopedLock locker(*m_cs); + m_envelope->removePointsConditionally([](const envelope_node& pt) { return pt.Status == 1; }); + if (m_envelope->GetNumNodes() == 0) + m_envelope->AddNode({ 0.0,0.5 }); + } repaint(); OnEnvelopeEdited(m_envelope.get()); - return true; } return false;