Salome HOME
23092: EDF 10836 SMESH: UseExisting2DElements fails when geometry contains more than...
[modules/smesh.git] / src / SMESH / SMESH_subMesh.cxx
index 1d481713389949ea9a25e52312fb123c7e805267..3745a2b77afe3dcce5911f5de6506c17cef6f2fc 100644 (file)
@@ -2470,11 +2470,8 @@ void SMESH_subMesh::deleteOwnListeners()
   list< OwnListenerData >::iterator d;
   for ( d = _ownListeners.begin(); d != _ownListeners.end(); ++d )
   {
-    if ( !_father->MeshExists( d->myMeshID ))
-      continue;
-    if ( _father->GetId() == d->myMeshID &&
-         this->GetId()    != d->mySubMeshID &&
-         !_father->GetSubMeshContaining( d->mySubMeshID ))
+    SMESH_Mesh* mesh = _father->FindMesh( d->myMeshID );
+    if ( !mesh || !mesh->GetSubMeshContaining( d->mySubMeshID ))
       continue;
     d->mySubMesh->DeleteEventListener( d->myListener );
   }