Prevent cycles in controller connections.

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1440 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Paul Giblock
2008-08-19 02:51:00 +00:00
parent 275a0d30e2
commit faff20a99b
5 changed files with 69 additions and 20 deletions

View File

@@ -190,6 +190,36 @@ controller * controller::create( const QDomElement & _this, model * _parent )
bool controller::hasModel( const model * m )
{
QObjectList chldren = children();
for( int i = 0; i < chldren.size(); ++i )
{
QObject * c = chldren.at(i);
automatableModel * am = qobject_cast<automatableModel*>(c);
if( am != NULL )
{
if( am == m )
{
return true;
}
controllerConnection * cc = am->getControllerConnection();
if( cc != NULL )
{
if( cc->getController()->hasModel( m ) )
{
return true;
}
}
}
}
return false;
}
void controller::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
_this.setAttribute( "type", type() );