Salome HOME
Update copyright information
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_FindElemByPointDlg.cxx
index 7e4fb90967488ac6360b8aab69d49c5e5e081c47..891cd56a3c38385320cd3a0896b192c5aae3e78c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -453,9 +453,6 @@ void SMESHGUI_FindElemByPointOp::onSelectionDone()
   if ( !myMeshIO.IsNull() && myMeshIO->hasEntry() )
     oldMeshEntry = myMeshIO->getEntry();
 
-  myDlg->myMeshName->setText("");
-  myMeshIO.Nullify();
-
   try {
     SALOME_ListIO aList;
     selectionMgr()->selectedObjects(aList, SVTK_Viewer::Type());
@@ -464,13 +461,16 @@ void SMESHGUI_FindElemByPointOp::onSelectionDone()
       Handle(SALOME_InteractiveObject) anIO = aList.First();
       _PTR(SObject) pObj = studyDS()->FindObjectID(anIO->getEntry());
       CORBA::Object_var anObj = SMESH::IObjectToObject( anIO );
-      myMeshOrPart = SMESH::SMESH_IDSource::_narrow(anObj);
-      if ( pObj && !myMeshOrPart->_is_nil() )
+      newMeshEntry = anIO->getEntry();
+      SMESH::SMESH_IDSource_var aMeshOrPart = SMESH::SMESH_IDSource::_narrow(anObj);
+      if ( pObj && !aMeshOrPart->_is_nil() && oldMeshEntry != newMeshEntry )
       {
+        myMeshOrPart = aMeshOrPart;
+        myMeshIO.Nullify();
         myMeshIO = anIO;
         std::string name = pObj->GetName();
+        myDlg->myMeshName->setText("");
         myDlg->myMeshName->setText( QString( name.c_str() ).trimmed() );
-        newMeshEntry = anIO->getEntry();
         SMESH::array_of_ElementType_var  types = myMeshOrPart->GetTypes();
         myDlg->setTypes( types );
       }