1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0023523: In session DRAW it is impossible to close document having name already once closed document.

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
This commit is contained in:
gka 2012-12-14 16:17:11 +04:00
parent 7a06c690fb
commit 24de79c3a5
25 changed files with 47 additions and 32 deletions

View File

@ -68,9 +68,10 @@ is
Initialize; Initialize;
Destroy(me: mutable) is protected;
---C++: alias ~
---Category: virtual methods ---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) 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 ---Purpose: The Update method will be called once for each

View File

@ -297,8 +297,11 @@ static Standard_Integer DDocStd_Close (Draw_Interpretor& di,
Handle(TDocStd_Application) A; Handle(TDocStd_Application) A;
if (!DDocStd::Find(A)) return 1; if (!DDocStd::Find(A)) return 1;
A->Close(D); A->Close(D);
Handle(Draw_Drawable3D) DD = Draw::Get(a[1],Standard_False); Handle(Draw_Drawable3D) DD = Draw::Get(a[1],Standard_False);
dout.RemoveDrawable (DD); dout.RemoveDrawable (DD);
Handle(Draw_Drawable3D) aDNull;
Draw::Set(a[1], aDNull);
return 0; return 0;
} }
di << "DDocStd_Close : Error" << "\n"; di << "DDocStd_Close : Error" << "\n";

View File

@ -49,9 +49,9 @@ uses Data from TDF,
is is
--Destroy (me : mutable); Destroy (me : mutable) is redefined protected;
---Purpose: Will Abort any execution, and commit the Undo transaction ---Purpose: Will Abort any execution, clear fields
-----C++: alias ~ ---C++: alias ~
Get (myclass; L : Label from TDF) Get (myclass; L : Label from TDF)
---Purpose: returns the document which contains <L>. raises an ---Purpose: returns the document which contains <L>. raises an

View File

@ -74,10 +74,17 @@ Handle(TDocStd_Document) TDocStd_Document::Get (const TDF_Label& acces)
//function : Destroy //function : Destroy
//purpose : //purpose :
//======================================================================= //=======================================================================
// void TDocStd_Document::Destroy() void TDocStd_Document::Destroy()
// { {
// myUndoTransaction.Commit(); // no needs to store the Undo SetModificationMode(Standard_False);
// } myData->Root().ForgetAllAttributes(Standard_True);
myUndoTransaction.Abort();
if(!myUndoFILO.IsEmpty())
myUndoFILO.Clear();
ClearUndos();
myData.Nullify();
}
//======================================================================= //=======================================================================

View File

@ -135,7 +135,7 @@ is
GetCollectorFromContext returns Viewer from V3d; GetCollectorFromContext returns Viewer from V3d;
GetAISContext returns InteractiveContext from AIS; GetAISContext returns InteractiveContext from AIS;
---C++: return const &
GetNISContext returns InteractiveContext from NIS; GetNISContext returns InteractiveContext from NIS;
---C++: return & ---C++: return &
@ -144,7 +144,8 @@ is
SetNISContext (aContext: InteractiveContext from NIS); SetNISContext (aContext: InteractiveContext from NIS);
CurrentView returns View from V3d; CurrentView returns View from V3d;
---C++: return const &
CurrentView (aViou:View from V3d); CurrentView (aViou:View from V3d);
Clear ; Clear ;

View File

@ -334,17 +334,19 @@ static void VwrTst_InitEventMgr(const Handle(NIS_View)& aView,
theEventMgrs.Prepend(new ViewerTest_EventManager(aView, Ctx)); theEventMgrs.Prepend(new ViewerTest_EventManager(aView, Ctx));
} }
static Handle(V3d_View)& a3DView(){ static Handle(V3d_View)& a3DView()
{
static Handle(V3d_View) Viou; static Handle(V3d_View) Viou;
return Viou; return Viou;
} }
Standard_EXPORT Handle(AIS_InteractiveContext)& TheAISContext(){ Standard_EXPORT Handle(AIS_InteractiveContext)& TheAISContext(){
static Handle(AIS_InteractiveContext) aContext; static Handle(AIS_InteractiveContext) aContext;
return aContext; return aContext;
} }
Handle(V3d_View) ViewerTest::CurrentView() const Handle(V3d_View)& ViewerTest::CurrentView()
{ {
return a3DView(); return a3DView();
} }
@ -363,7 +365,7 @@ Standard_EXPORT const Handle(NIS_InteractiveContext)& TheNISContext()
return aContext; return aContext;
} }
Handle(AIS_InteractiveContext) ViewerTest::GetAISContext() const Handle(AIS_InteractiveContext)& ViewerTest::GetAISContext()
{ {
return TheAISContext(); return TheAISContext();
} }

View File

@ -21,7 +21,7 @@ for {set i 1} {$i < 10} {incr i} {
# close document # close document
Close D Close D
unset D
# unload shape (replace by small one) # unload shape (replace by small one)
vertex a 0 0 0 vertex a 0 0 0

View File

@ -39,7 +39,7 @@ set aFile ${imagedir}/caf001-G3.std
file delete ${aFile} file delete ${aFile}
SaveAs D ${aFile} SaveAs D ${aFile}
if { ![file exists ${aFile}] } { if { ![file exists ${aFile}] } {
puts "There is not ${aFile} file; SaveAs command: Error" puts "There is no file ${aFile}; SaveAs command: Error"
return return
} }
#catch {exec chmod 777 ${aFile}} #catch {exec chmod 777 ${aFile}}

View File

@ -64,6 +64,7 @@ if { ${IsDone} != 0 } {
puts "Get a value of TPrsStd_AISPresentation attribute from restoring document: Error" puts "Get a value of TPrsStd_AISPresentation attribute from restoring document: Error"
puts "OCC1228: ERROR (case 2)" puts "OCC1228: ERROR (case 2)"
} else { } else {
Close DDoc
puts "There is the box in the viewer" puts "There is the box in the viewer"
puts "OCC1228: OK" puts "OCC1228: OK"
} }

View File

@ -18,7 +18,7 @@
#pload FULL #pload FULL
erase erase
Close D Close D
unset D
NewDocument D MDTV-Standard NewDocument D MDTV-Standard
isos 12 isos 12
#1 - create box using more flexible set of commands #1 - create box using more flexible set of commands

View File

@ -18,7 +18,7 @@
#pload FULL #pload FULL
erase erase
Close D Close D
unset D
NewDocument D MDTV-Standard NewDocument D MDTV-Standard
#Drivers' nick-names: #Drivers' nick-names:

View File

@ -17,7 +17,7 @@
#pload FULL #pload FULL
erase erase
Close D Close D
unset D
NewDocument D MDTV-Standard NewDocument D MDTV-Standard
AddDriver D Box Cyl Sph Attach XAttach PTxyz PTALine PRLine PMirr Cut Fuse Prism FulRevol SecRevol Fillet AddDriver D Box Cyl Sph Attach XAttach PTxyz PTALine PRLine PMirr Cut Fuse Prism FulRevol SecRevol Fillet

View File

@ -17,7 +17,7 @@
erase erase
Close D Close D
unset D
NewDocument D MDTV-Standard NewDocument D MDTV-Standard
AddDriver D Box Cyl Sph Attach XAttach PTxyz PTALine PRLine PMirr Cut Fuse Prism FulRevol SecRevol Fillet AddDriver D Box Cyl Sph Attach XAttach PTxyz PTALine PRLine PMirr Cut Fuse Prism FulRevol SecRevol Fillet

View File

@ -17,7 +17,7 @@
erase erase
Close D Close D
unset D
NewDocument D MDTV-Standard NewDocument D MDTV-Standard
AddDriver D Box Cyl Sph Attach XAttach PTxyz PTALine PRLine PMirr Cut Fuse Prism FulRevol SecRevol Fillet AddDriver D Box Cyl Sph Attach XAttach PTxyz PTALine PRLine PMirr Cut Fuse Prism FulRevol SecRevol Fillet

View File

@ -21,7 +21,7 @@
erase erase
Close D Close D
unset D
NewDocument D MDTV-Standard NewDocument D MDTV-Standard
#1 - create Box using short-cut #1 - create Box using short-cut

View File

@ -21,7 +21,7 @@
#pload FULL #pload FULL
erase erase
Close D Close D
unset D
NewDocument D MDTV-Standard NewDocument D MDTV-Standard
#Drivers' nick-names: #Drivers' nick-names:

View File

@ -19,7 +19,7 @@
#pload FULL #pload FULL
erase erase
Close D Close D
unset D
NewDocument D MDTV-Standard NewDocument D MDTV-Standard
#Drivers' nick-names: #Drivers' nick-names:

View File

@ -18,7 +18,7 @@
#pload FULL #pload FULL
erase erase
Close D Close D
unset D
NewDocument D MDTV-Standard NewDocument D MDTV-Standard
isos 12 isos 12

View File

@ -22,7 +22,7 @@
#pload FULL #pload FULL
erase erase
Close D Close D
unset D
NewDocument D MDTV-Standard NewDocument D MDTV-Standard
AddDriver D Box Cyl Sph Attach XAttach PTxyz PTALine PRLine PMirr Cut Fuse Prism FulRevol SecRevol Fillet AddDriver D Box Cyl Sph Attach XAttach PTxyz PTALine PRLine PMirr Cut Fuse Prism FulRevol SecRevol Fillet

View File

@ -19,7 +19,7 @@
#pload FULL #pload FULL
erase erase
Close D Close D
unset D
NewDocument D MDTV-Standard NewDocument D MDTV-Standard
isos 12 isos 12
#1 - create Box using short-cut #1 - create Box using short-cut

View File

@ -25,7 +25,7 @@
#pload FULL #pload FULL
erase erase
Close D Close D
unset D
NewDocument D MDTV-Standard NewDocument D MDTV-Standard
isos 12 isos 12
#1 - create Box using short-cut #1 - create Box using short-cut

View File

@ -17,7 +17,7 @@
#pload FULL #pload FULL
erase erase
Close D Close D
unset D
NewDocument D MDTV-Standard NewDocument D MDTV-Standard
#Drivers' nick-names: #Drivers' nick-names:

View File

@ -20,7 +20,7 @@
#pload FULL #pload FULL
erase erase
Close D Close D
unset D
NewDocument D MDTV-Standard NewDocument D MDTV-Standard
isos 12 isos 12

View File

@ -22,7 +22,7 @@
#pload FULL #pload FULL
erase erase
Close D Close D
unset D
NewDocument D MDTV-Standard NewDocument D MDTV-Standard
isos 12 isos 12

View File

@ -21,7 +21,7 @@
#pload FULL #pload FULL
erase erase
Close D Close D
unset D
NewDocument D MDTV-Standard NewDocument D MDTV-Standard
isos 12 isos 12