From ad1c6957b0c19e6150fbc0ffb9dd6e63e50a2f1d Mon Sep 17 00:00:00 2001 From: Vesa Date: Sat, 14 Jun 2014 18:36:17 +0300 Subject: [PATCH] AutomatableModel: prevent linking of model to itself There's no need to ever link a model to itself, allowing it can cause weird issues and crashes, plus it's easy to do by accident if you start a ctrl-drag and end it while still on the same widget --- src/core/AutomatableModel.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/AutomatableModel.cpp b/src/core/AutomatableModel.cpp index b11374e9a..e8e22e5c2 100644 --- a/src/core/AutomatableModel.cpp +++ b/src/core/AutomatableModel.cpp @@ -394,7 +394,7 @@ float AutomatableModel::fittedValue( float value ) const void AutomatableModel::linkModel( AutomatableModel* model ) { - if( !m_linkedModels.contains( model ) ) + if( !m_linkedModels.contains( model ) && model != this ) { m_linkedModels.push_back( model ); m_hasLinkedModels = true; @@ -426,8 +426,8 @@ void AutomatableModel::unlinkModel( AutomatableModel* model ) void AutomatableModel::linkModels( AutomatableModel* model1, AutomatableModel* model2 ) { - model1->linkModel( model2 ); - model2->linkModel( model1 ); + model1->linkModel( model2 ); + model2->linkModel( model1 ); }