From 2592a4ecc4f6c016cffe9637308efc70bf564de0 Mon Sep 17 00:00:00 2001 From: ptv Date: Wed, 17 Nov 2010 08:20:26 +0000 Subject: [PATCH] optimise code --- src/CAM/CAM_Module.cxx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/CAM/CAM_Module.cxx b/src/CAM/CAM_Module.cxx index 8e39ab66b..e8415e344 100755 --- a/src/CAM/CAM_Module.cxx +++ b/src/CAM/CAM_Module.cxx @@ -951,12 +951,16 @@ void CAM_Module::connectToStudy( CAM_Study* camStudy ) for( QList::const_iterator it = mods.begin(); it != mods.end(); ++it ) { CAM_DataModel* dm = (*it)->dataModel(); - if( (*it) == this && !camStudy->containsDataModel( dm ) ) + if( (*it) == this ) { - if ( prev ) - camStudy->insertDataModel( (*it)->dataModel(), prev ); - else - camStudy->insertDataModel( (*it)->dataModel(), 0 ); + if ( !camStudy->containsDataModel( dm ) ) + { + if ( prev ) + camStudy->insertDataModel( (*it)->dataModel(), prev ); + else + camStudy->insertDataModel( (*it)->dataModel(), 0 ); + } + return; } prev = dm; } -- 2.39.2