]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Fix for bug Bug IPAL20288 (4x: CRASH after trying to build a sketch).
authormzn <mzn@opencascade.com>
Wed, 10 Sep 2008 14:02:58 +0000 (14:02 +0000)
committermzn <mzn@opencascade.com>
Wed, 10 Sep 2008 14:02:58 +0000 (14:02 +0000)
src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx
src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx
src/GEOM_I/GEOM_ICurvesOperations_i.cc

index 9a497b2e9458fc643343d06368aea882beba3610..3bd246817d1fa83ce43cf6d7581f97ecf7938cfa 100644 (file)
@@ -648,13 +648,12 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineInterpolation
  *  MakeSketcher
  */
 //=============================================================================
-Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcher
-                               (const TCollection_AsciiString& theCommand,
-                                list<double>                   theWorkingPlane)
+Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcher (const char* theCommand,
+                                                             list<double> theWorkingPlane)
 {
   SetErrorCode(KO);
 
-  if (theCommand.IsEmpty()) return NULL;
+  if (!theCommand || strcmp(theCommand, "") == 0) return NULL;
 
   //Add a new Sketcher object
   Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GetDocID(), GEOM_SKETCHER);
@@ -669,7 +668,8 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcher
 
   GEOMImpl_ISketcher aCI (aFunction);
 
-  aCI.SetCommand(theCommand);
+  TCollection_AsciiString aCommand((char*) theCommand);
+  aCI.SetCommand(aCommand);
 
   int ind = 1;
   list<double>::iterator it = theWorkingPlane.begin();
@@ -694,7 +694,7 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcher
 
   //Make a Python command
   GEOM::TPythonDump pd (aFunction);
-  pd << aSketcher << " = geompy.MakeSketcher(\"" << theCommand.ToCString() << "\", [";
+  pd << aSketcher << " = geompy.MakeSketcher(\"" << aCommand.ToCString() << "\", [";
 
   it = theWorkingPlane.begin();
   pd << (*it++);
@@ -713,12 +713,12 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcher
  */
 //=============================================================================
 Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcherOnPlane
-                               (const TCollection_AsciiString& theCommand,
+                               (const char* theCommand,
                                 Handle(GEOM_Object)            theWorkingPlane)
 {
   SetErrorCode(KO);
 
-  if (theCommand.IsEmpty()) return NULL;
+  if (!theCommand || strcmp(theCommand, "") == 0) return NULL;
 
   //Add a new Sketcher object
   Handle(GEOM_Object) aSketcher = GetEngine()->AddObject(GetDocID(), GEOM_SKETCHER);
@@ -732,7 +732,9 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcherOnPlane
   if (aFunction->GetDriverGUID() != GEOMImpl_SketcherDriver::GetID()) return NULL;
 
   GEOMImpl_ISketcher aCI (aFunction);
-  aCI.SetCommand(theCommand);
+
+  TCollection_AsciiString aCommand((char*) theCommand);
+  aCI.SetCommand(aCommand);
 
   Handle(GEOM_Function) aRefPlane = theWorkingPlane->GetLastFunction();
   if (aRefPlane.IsNull()) return NULL;
@@ -756,7 +758,7 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcherOnPlane
 
   //Make a Python command
   GEOM::TPythonDump (aFunction) << aSketcher << " = geompy.MakeSketcherOnPlane(\""
-    << theCommand.ToCString() << "\", " << theWorkingPlane << " )";
+    << aCommand.ToCString() << "\", " << theWorkingPlane << " )";
 
   SetErrorCode(OK);
   return aSketcher;
index 34bb01148b69bdfbc849d39450086314b1edb93c..ed6605d0dbc62d84ceb744096666751ecfa52eb3 100644 (file)
@@ -63,9 +63,9 @@ class GEOMImpl_ICurvesOperations : public GEOM_IOperations {
   Standard_EXPORT Handle(GEOM_Object) MakeSplineBezier        (list<Handle(GEOM_Object)> thePoints);
   Standard_EXPORT Handle(GEOM_Object) MakeSplineInterpolation (list<Handle(GEOM_Object)> thePoints);
 
-  Standard_EXPORT Handle(GEOM_Object) MakeSketcher (const TCollection_AsciiString& theCommand,
+  Standard_EXPORT Handle(GEOM_Object) MakeSketcher (const char* theCommand,
                                                     list<double> theWorkingPlane);
-  Standard_EXPORT Handle(GEOM_Object) MakeSketcherOnPlane (const TCollection_AsciiString& theCommand,
+  Standard_EXPORT Handle(GEOM_Object) MakeSketcherOnPlane (const char* theCommand,
                                                            Handle(GEOM_Object) theWorkingPlane);
 };
 
index 3bda04930809c3c7c0eda7a24371d57bbd9c3bd8..94d8a03f5f4fb3e3045e9be12307d08c6724dd3f 100644 (file)
@@ -400,7 +400,7 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcher
 
   // Make Sketcher
   Handle(GEOM_Object) anObject =
-    GetOperations()->MakeSketcher((char*)theCommand, aWorkingPlane);
+    GetOperations()->MakeSketcher(theCommand, aWorkingPlane);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return GEOM::GEOM_Object::_nil();
 
@@ -424,7 +424,7 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcherOnPlane
 
   // Make Sketcher
   Handle(GEOM_Object) anObject =
-      GetOperations()->MakeSketcherOnPlane((char*)theCommand, aWorkingPlane);
+      GetOperations()->MakeSketcherOnPlane(theCommand, aWorkingPlane);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return GEOM::GEOM_Object::_nil();