]> OCCT Git - occt-copy.git/commitdiff
0023523: In session DRAW it is impossible to close document having name already once...
authorgka <gka@opencascade.com>
Fri, 14 Dec 2012 12:17:11 +0000 (16:17 +0400)
committergka <gka@opencascade.com>
Fri, 14 Dec 2012 12:17:11 +0000 (16:17 +0400)
Added destructor for TDocStd_Document which performs destruction of document in logical order in order to avoid exception when Undo and Redo fields are destructed after THF_Data field.
Added removing name of closed document from tcl variables in the DRAW in order to avoid exception during use the same name for new document.
Modification to avoid compilation error class ViewerTest
Minor correction in test caf basic G3

25 files changed:
src/CDM/CDM_Document.cdl
src/DDocStd/DDocStd_ApplicationCommands.cxx
src/TDocStd/TDocStd_Document.cdl
src/TDocStd/TDocStd_Document.cxx
src/ViewerTest/ViewerTest.cdl
src/ViewerTest/ViewerTest.cxx
tests/bugs/caf/bug23489
tests/caf/basic/G3
tests/caf/bugs/B6
tests/caf/named_shape/E1
tests/caf/named_shape/E2
tests/caf/named_shape/E3
tests/caf/named_shape/E4
tests/caf/named_shape/E5
tests/caf/named_shape/E6
tests/caf/named_shape/E7
tests/caf/named_shape/E8
tests/caf/named_shape/E9
tests/caf/named_shape/F1
tests/caf/named_shape/F2
tests/caf/named_shape/F3
tests/caf/named_shape/F4
tests/caf/named_shape/F5
tests/caf/named_shape/F6
tests/caf/named_shape/F7

index 221a5adf286f4b0d7e823e4e85071107fc9fb562..3cc2eeb44ddceae4270554cde4aab8c2ce796bef 100755 (executable)
@@ -68,9 +68,10 @@ is
 
     Initialize;
      
-    Destroy(me: mutable) is protected;
-    ---C++: alias ~
 ---Category: virtual methods
+    Destroy(me: mutable) is virtual protected;
+    ---C++: alias ~
+    
 
     Update(me: mutable; aToDocument: Document from CDM; aReferenceIdentifier: Integer from Standard; aModifContext: Address from Standard)
     ---Purpose: The Update  method  will be called  once  for each
index dacd083e4afdb2198da88de33b8db493e1136314..593fde7e1179477e09dcf5eb9676f9fe4944be54 100755 (executable)
@@ -297,8 +297,11 @@ static Standard_Integer DDocStd_Close (Draw_Interpretor& di,
     Handle(TDocStd_Application) A;
     if (!DDocStd::Find(A)) return 1;
     A->Close(D); 
+
     Handle(Draw_Drawable3D) DD = Draw::Get(a[1],Standard_False);
     dout.RemoveDrawable (DD);
+    Handle(Draw_Drawable3D) aDNull;
+    Draw::Set(a[1], aDNull);
     return 0;
   }
   di << "DDocStd_Close : Error" << "\n";
index b10bdce10a69e0c19c378d7ec42a4866feb04812..938f67cd2a82c5c284b455b92be68e59f9761432 100755 (executable)
@@ -49,9 +49,9 @@ uses Data           from TDF,
 
 is
    
-    --Destroy (me : mutable);
-    ---Purpose: Will Abort any execution, and commit the Undo transaction
-    -----C++: alias ~
+    Destroy (me : mutable) is redefined protected;
+    ---Purpose: Will Abort any execution, clear fields
+    ---C++: alias ~
 
     Get (myclass; L : Label from TDF)
        ---Purpose: returns the    document which contains <L>.  raises  an
index df85eaf30a7ba7b8c5251080b5c2c935b8160719..2c141623c1ccdf3299f4e03468598dfa699dd637 100755 (executable)
@@ -74,10 +74,17 @@ Handle(TDocStd_Document) TDocStd_Document::Get (const TDF_Label& acces)
 //function : Destroy
 //purpose  : 
 //=======================================================================
-// void TDocStd_Document::Destroy()
-// {
-//   myUndoTransaction.Commit(); // no needs to store the Undo
-// }
+void TDocStd_Document::Destroy()
+{
+  SetModificationMode(Standard_False);
+  myData->Root().ForgetAllAttributes(Standard_True);
+  myUndoTransaction.Abort();
+  if(!myUndoFILO.IsEmpty())
+    myUndoFILO.Clear();
+  ClearUndos();
+  myData.Nullify();
+  
+}
 
 
 //=======================================================================
index 8ee7d9f4afd93b226c07c374a1645d519b867380..e254c54dd1146d1d9604cb95fc0098fdead02e6c 100755 (executable)
@@ -135,7 +135,7 @@ is
     GetCollectorFromContext returns Viewer from V3d;
 
     GetAISContext returns InteractiveContext from AIS;
-
+       ---C++: return const &
     GetNISContext returns InteractiveContext from NIS;
     ---C++: return &
 
@@ -144,7 +144,8 @@ is
     SetNISContext (aContext: InteractiveContext from NIS);
 
     CurrentView returns View from V3d;
-
+       ---C++: return const &
+       
     CurrentView (aViou:View from V3d);
 
     Clear ;
index f3146c65b8bfa52ff48a54b600d9ad625215e886..0efa670d68b6c6a4876d34b0ad6c1426911b75c0 100755 (executable)
@@ -334,17 +334,19 @@ static void VwrTst_InitEventMgr(const Handle(NIS_View)& aView,
   theEventMgrs.Prepend(new ViewerTest_EventManager(aView, Ctx));
 }
 
-static Handle(V3d_View)&  a3DView(){
+static Handle(V3d_View)&  a3DView()
+{
   static Handle(V3d_View) Viou;
   return Viou;
 }
 
+
 Standard_EXPORT Handle(AIS_InteractiveContext)& TheAISContext(){
   static Handle(AIS_InteractiveContext) aContext;
   return aContext;
 }
 
-Handle(V3d_View) ViewerTest::CurrentView()
+const Handle(V3d_View)& ViewerTest::CurrentView()
 {
   return a3DView();
 }
@@ -363,7 +365,7 @@ Standard_EXPORT const Handle(NIS_InteractiveContext)& TheNISContext()
   return aContext;
 }
 
-Handle(AIS_InteractiveContext) ViewerTest::GetAISContext()
+const Handle(AIS_InteractiveContext)& ViewerTest::GetAISContext()
 {
   return TheAISContext();
 }
index 6e72af0af710c2f0dacb17ee3096403733ab9996..4ca3a4da99e41f5c838b6c3653e7384f7007842a 100755 (executable)
@@ -21,7 +21,7 @@ for {set i 1} {$i < 10} {incr i} {
 
     # close document
     Close D
-    unset D
+   
 
     # unload shape (replace by small one)
     vertex a 0 0 0
index b00ffce2ca1cb94d9c2c48436866422e2852acad..b7b9866d462530262f325b9815bd7aeaf5587d62 100755 (executable)
@@ -39,7 +39,7 @@ set aFile ${imagedir}/caf001-G3.std
 file delete ${aFile}
 SaveAs D ${aFile}
 if { ![file exists ${aFile}] } {
-       puts "There is not ${aFile} file; SaveAs command: Error"
+       puts "There is no file ${aFile}; SaveAs command: Error"
        return
 }
 #catch {exec chmod 777 ${aFile}}
index 5843509a21f2032745529fd30409aac80ed3ef3d..e5fd63756ef5431c229207db5f8c9309571f621c 100755 (executable)
@@ -64,6 +64,7 @@ if { ${IsDone} != 0 } {
        puts "Get a value of TPrsStd_AISPresentation attribute from restoring document: Error"
        puts "OCC1228: ERROR (case 2)"
 } else {
+        Close DDoc
        puts "There is the box in the viewer"
        puts "OCC1228: OK"
 }
index d7f08105701c78b74b98cf50227fab4a70bd3e02..c36b93e0f506d68bd36c832e0c1c8da4f358ec1f 100644 (file)
@@ -18,7 +18,7 @@
 #pload FULL
 erase 
 Close D 
-unset D
+
 NewDocument D MDTV-Standard
 isos 12
 #1 - create box using more flexible set of commands
index 568e0bc3772962db84156c2b6ba4157e920a1b2f..30691cd6e0de79c2e4f39f61fb8177562fe56045 100644 (file)
@@ -18,7 +18,7 @@
 #pload FULL
 erase
 Close D
-unset D
+
 NewDocument D MDTV-Standard
 
 #Drivers' nick-names:
index eebcb62f70bae365750a6494952d07b9af6c142c..c752b15efcc6dab0bf62933c175fa550dc86688b 100644 (file)
@@ -17,7 +17,7 @@
 #pload FULL
 erase 
 Close D 
-unset D
+
 NewDocument D MDTV-Standard
 
 AddDriver D Box Cyl Sph Attach XAttach PTxyz PTALine PRLine PMirr Cut Fuse Prism FulRevol SecRevol Fillet
index 167957ccc836bfc4ecc33bbc062d1f098b20feb5..ee82d1a9ccedf530b1eb2a95ae1e142e68a02784 100644 (file)
@@ -17,7 +17,7 @@
 
 erase 
 Close D 
-unset D
+
 NewDocument D MDTV-Standard
 
 AddDriver D Box Cyl Sph Attach XAttach PTxyz PTALine PRLine PMirr Cut Fuse Prism FulRevol SecRevol Fillet
index 7ac47bb5efff68778afaaabef0b3287b8af1027d..62b506a7caa5a0dcb795358746bf7608e1ed4163 100644 (file)
@@ -17,7 +17,7 @@
 
 erase 
 Close D 
-unset D
+
 NewDocument D MDTV-Standard
 
 AddDriver D Box Cyl Sph Attach XAttach PTxyz PTALine PRLine PMirr Cut Fuse Prism FulRevol SecRevol Fillet
index c1eac6727049b5ee40887f903a62cb9830296b07..ec81f8981e7525c5faeafe4dd3145b7a3e47c85f 100644 (file)
@@ -21,7 +21,7 @@
 
 erase 
 Close D 
-unset D
+
 NewDocument D MDTV-Standard
 
 #1 - create Box using short-cut
index 7eb3d5609128514d4c583fb0805986bcc0e37fb4..7a0e2ac99fd36d870b862a12408678a40928b118 100644 (file)
@@ -21,7 +21,7 @@
 #pload FULL
 erase
 Close D
-unset D
+
 NewDocument D MDTV-Standard
 
 #Drivers' nick-names:
index a88dea045a1bcb343f68556fe5447d3b4d78db7e..a8d6864fe26e19f440631d05fb42dd6c592d0a84 100644 (file)
@@ -19,7 +19,7 @@
 #pload FULL
 erase
 Close D
-unset D
+
 NewDocument D MDTV-Standard
 
 #Drivers' nick-names:
index c1b9e5f0ae2176ccf380844a6e061903cb04176a..1223e9d5787338d65282cd56b4a97c606a9fba01 100644 (file)
@@ -18,7 +18,7 @@
 #pload FULL
 erase 
 Close D 
-unset D
+
 NewDocument D MDTV-Standard
 isos 12
 
index f7ae3533dfef47f2ad2b8365fb167587b0f89dfb..aced514bb1ae08b32eb5926f9ec01e9fcc0fd0cc 100644 (file)
@@ -22,7 +22,7 @@
 #pload FULL
 erase 
 Close D 
-unset D
+
 NewDocument D MDTV-Standard
 AddDriver D Box Cyl Sph Attach XAttach PTxyz PTALine PRLine PMirr Cut Fuse Prism FulRevol SecRevol Fillet
 
index b71c86520ef4981b70b4f06e6ed94eb6b584848c..d38957ad4d46716bfd74a3e76a2a8df7cc6d775e 100644 (file)
@@ -19,7 +19,7 @@
 #pload FULL
 erase 
 Close D 
-unset D
+
 NewDocument D MDTV-Standard
 isos 12
 #1 - create Box using short-cut
index b0f2f30f12ade1be0f901ccd6845556ec9beb6f4..74733f97838b42a21715c6a537bdcc9b2def5657 100644 (file)
@@ -25,7 +25,7 @@
 #pload FULL
 erase 
 Close D 
-unset D
+
 NewDocument D MDTV-Standard
 isos 12
 #1 - create Box using short-cut
index c3c7e88e1636a687ad48afe4159b213f644dad8c..8f39e59b87a8c3cdbefa47c462ac062f1f66862a 100644 (file)
@@ -17,7 +17,7 @@
 #pload FULL
 erase
 Close D
-unset D
+
 NewDocument D MDTV-Standard
 
 #Drivers' nick-names:
index 49b9a161c5895b0b7eb7240216f5d22957a89961..347a550c8cdef41cf10aec766ab5e6e72061d46b 100644 (file)
@@ -20,7 +20,7 @@
 #pload FULL
 erase 
 Close D 
-unset D
+
 NewDocument D MDTV-Standard
 isos 12
 
index c51d62fe87882f64909805a4daf3be83b77a94b9..d906bb6f7ccc7dbc4ebb4c2d8e0e6f3ae1b20a86 100755 (executable)
@@ -22,7 +22,7 @@
 #pload FULL
 erase 
 Close D 
-unset D
+
 NewDocument D MDTV-Standard
 isos 12
 
index 5949f8d2b25d5daee19da7c2c6989d11ce824129..cbbb7233890be0f79ffa5af57a3f5fc44daaef1f 100644 (file)
@@ -21,7 +21,7 @@
 #pload FULL
 erase 
 Close D 
-unset D
+
 NewDocument D MDTV-Standard
 isos 12