From 6b9ff4e9d341439c73f45d1f6b8c5a827757bf3f Mon Sep 17 00:00:00 2001 From: Michael Gregorius Date: Mon, 7 Sep 2015 20:40:16 +0200 Subject: [PATCH] Fixes for the tension dial (crash + missing update) Fixes a crash that occurred when the tension dial of the automation editor was moved when no pattern was loaded. Also added a missing update of the tension dial when the automation patterns are switched. --- src/gui/editors/AutomationEditor.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gui/editors/AutomationEditor.cpp b/src/gui/editors/AutomationEditor.cpp index 99516b28d..eb066a65e 100644 --- a/src/gui/editors/AutomationEditor.cpp +++ b/src/gui/editors/AutomationEditor.cpp @@ -281,6 +281,8 @@ void AutomationEditor::updateAfterPatternChange() m_step = m_pattern->firstObject()->step(); m_scrollLevel = ( m_minLevel + m_maxLevel ) / 2; + m_tensionModel->setValue( m_pattern->getTension() ); + // resizeEvent() does the rest for us (scrolling, range-checking // of levels and so on...) resizeEvent( NULL ); @@ -1676,8 +1678,11 @@ void AutomationEditor::setProgressionType(int type) void AutomationEditor::setTension() { - m_pattern->setTension( QString::number( m_tensionModel->value() ) ); - update(); + if ( m_pattern ) + { + m_pattern->setTension( QString::number( m_tensionModel->value() ) ); + update(); + } }