OCAF document Issue : Deletion of XCAFDoc_ShapeTool object crashing in 6.5.4


We have a application which create/destruct object in following order.

Step 1 : TDocStd_Application* app = new DerivedClassFrom(TDocStd_Application)
Step 2 : TDocStd_Document* GetDoc()
Handle(TDocStd_Document) doc;
app->NewDocument("BinOcaf", doc);

return (static_cast(doc.Access());

Step 3: Handle(XCAFDoc_ShapeTool) *_shapeTool = new Handle(XCAFDoc_ShapeTool)(XCAFDoc_DocumentTool::ShapeTool(GetDoc()->Main()));

Step 4 : delete _shapeTool;


Above code steps are executed from Step 1 to 4 in order. This was working fine in case of 6.5.3
but Step 4 is crashing in 6.5.4.

My doubt is,
1. is there any changes in usage of handle in all above(Step1-4) classes/APIs used?
2. Is Step2 correct? I mean handle object going out of scope, but we are returning underlying entity pointer.

Has anyone faced similar problem?
Any help on this will be highly appreciable?

Daniel Park's picture