0027070: Segfault when transferring HLR-created shapes via STEPControl_Writer
[occt.git] / src / XSControl / XSControl_WorkSession.cxx
index 8c3f8fc..0ffc9fd 100644 (file)
@@ -13,8 +13,6 @@
 
 //:i1 pdn 03.04.99  BUC60301  
 
-#include <Dico_DictionaryOfTransient.hxx>
-#include <Dico_IteratorOfDictionaryOfTransient.hxx>
 #include <Geom2d_Point.hxx>
 #include <Interface_Check.hxx>
 #include <Interface_CheckIterator.hxx>
@@ -148,7 +146,7 @@ Standard_CString XSControl_WorkSession::SelectedNorm(const Standard_Boolean rsc)
 //purpose  : 
 //=======================================================================
 
-void XSControl_WorkSession::SetAllContext(const Handle(Dico_DictionaryOfTransient)& context)
+void XSControl_WorkSession::SetAllContext(const NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& context)
 {
   myContext = context;
   myTransferReader->Context() = context;
@@ -162,8 +160,8 @@ void XSControl_WorkSession::SetAllContext(const Handle(Dico_DictionaryOfTransien
 
 void XSControl_WorkSession::ClearContext ()
 {
-  myContext.Nullify();
-  myTransferReader->Context().Nullify();
+  myContext.Clear();
+  myTransferReader->Context().Clear();
 }
 
 
@@ -207,7 +205,11 @@ Standard_Boolean  XSControl_WorkSession::PrintTransferStatus(const Standard_Inte
     }
 
     S<<"Transfer Write item n0."<<ne<<" of "<<max;
-    if (nr > 0) S<<"  ** Transfer Root n0."<<ne;  S<<endl;
+    if (nr > 0)
+    {
+      S<<"  ** Transfer Root n0."<<ne;
+    }
+    S<<endl;
     ent = FP->FindTransient(finder);
     S<<" -> Type "<<finder->DynamicType()->Name()<<endl;
     FP->StartTrace (binder,finder,0,0);  // pb sout/S
@@ -242,7 +244,11 @@ Standard_Boolean  XSControl_WorkSession::PrintTransferStatus(const Standard_Inte
     }
 
     S<<"Transfer Read item n0."<<ne<<" of "<<max;
-    if (nr > 0) S<<"  ** Transfer Root n0."<<ne;  S<<endl;
+    if (nr > 0)
+    {
+      S<<"  ** Transfer Root n0."<<ne;
+    }
+    S<<endl;
     if (!model.IsNull())  {  S<<" In Model, Entity ";  model->Print(ent,S); }
     binder = TP->MapItem (ne);
     S<<endl;
@@ -452,7 +458,10 @@ IFSelect_ReturnStatus XSControl_WorkSession::TransferWriteShape (const TopoDS_Sh
   IFSelect_ReturnStatus  status;
   if (myController.IsNull()) return IFSelect_RetError;
   const Handle(Interface_InterfaceModel) &model = Model();
-  if (model.IsNull()) return IFSelect_RetVoid;
+  if (model.IsNull() || shape.IsNull())
+  {
+    return IFSelect_RetVoid;
+  }
 
   status = myTransferWriter->TransferWriteShape (model,shape);
   //  qui s occupe de tout, try/catch inclus