]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs #441: crash in digue construction
authorasl <asl@opencascade.com>
Fri, 29 Aug 2014 12:43:50 +0000 (12:43 +0000)
committerasl <asl@opencascade.com>
Fri, 29 Aug 2014 12:43:50 +0000 (12:43 +0000)
src/HYDROGUI/HYDROGUI_ChannelOp.cxx
src/HYDROGUI/HYDROGUI_Tool.cxx
src/HYDROGUI/HYDROGUI_Tool.h

index e820deb641e97d42beba677505cbd82b080385ca..c91f314aae4240d51417ceade23825a764a9ff9d 100644 (file)
@@ -109,7 +109,7 @@ void HYDROGUI_ChannelOp::startOperation()
   }
 
   // collect information about existing profiles
-  QStringList aProfiles = HYDROGUI_Tool::FindExistingObjectsNames( doc(), KIND_PROFILE );
+  QStringList aProfiles = HYDROGUI_Tool::FindExistingObjectsNames( doc(), KIND_PROFILE, true );
 
   aPanel->setObjectName( anObjectName );
 
index 75526f52e295f1b136eb90d9b85a84d2875bb616..34f600f5cf43b907d6ab137c076f2f805b45739f 100644 (file)
@@ -31,6 +31,7 @@
 #include <HYDROData_Iterator.h>
 #include <HYDROData_ImmersibleZone.h>
 #include <HYDROData_Tool.h>
+#include <HYDROData_Profile.h>
 
 #include <GEOMBase.h>
 
@@ -693,16 +694,26 @@ QColor HYDROGUI_Tool::GenerateFillingColor( const Handle(HYDROData_Document)& th
 }
 
 QStringList HYDROGUI_Tool::FindExistingObjectsNames( const Handle(HYDROData_Document)& theDoc, 
-                                                     const ObjectKind theObjectKind )
+                                                     const ObjectKind theObjectKind,
+                                                     bool isCheckValidProfile )
 {
   QStringList aNames;
 
   HYDROData_Iterator anIter( theDoc, theObjectKind );
   for ( ; anIter.More(); anIter.Next() ) {
     Handle(HYDROData_Entity) anObject = anIter.Current();
-    if( !anObject.IsNull() ) {
-      aNames.append( anObject->GetName() );
+
+    bool isOK = !anObject.IsNull();
+    
+    if( isOK && isCheckValidProfile )
+    {
+      Handle_HYDROData_Profile aProfile = Handle_HYDROData_Profile::DownCast( anObject );
+      if( !aProfile.IsNull() && !aProfile->IsValid() )
+        isOK = false;
     }
+      
+    if( isOK )
+      aNames.append( anObject->GetName() );
   }
 
   return aNames;
index e1565e72f930c724ba82f3510da735d026e23120..d504cc4a405420c200bba67b2276c24488058b32 100644 (file)
@@ -335,7 +335,8 @@ public:
    * \return list of names
    */
   static QStringList              FindExistingObjectsNames( const Handle(HYDROData_Document)& theDoc, 
-                                                            const ObjectKind theObjectKind );
+                                                            const ObjectKind theObjectKind, 
+                                                            bool isCheckValidProfile = false );
 
   /**
    * \brief Converts coordinate value to string.