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
This commit is contained in:
Vesa
2014-06-14 18:36:17 +03:00
parent e733042cdb
commit ad1c6957b0

View File

@@ -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 );
}