From ef9a9362ae805f29204577131cd525cb49fed11f Mon Sep 17 00:00:00 2001 From: kgv Date: Fri, 11 Nov 2016 18:20:49 +0300 Subject: [PATCH] 0028093: Visualization - access violation on removal of dynamic highlighting after device loss OpenGl_Layer::Remove() now tries to remove object from myAlwaysRenderedMap if it was not removed from other groups. --- src/OpenGl/OpenGl_Layer.cxx | 20 ++++++++++++-------- tests/bugs/vis/bug28093 | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 tests/bugs/vis/bug28093 diff --git a/src/OpenGl/OpenGl_Layer.cxx b/src/OpenGl/OpenGl_Layer.cxx index 24585779bd..6b6c05e3a2 100644 --- a/src/OpenGl/OpenGl_Layer.cxx +++ b/src/OpenGl/OpenGl_Layer.cxx @@ -108,7 +108,18 @@ bool OpenGl_Layer::Remove (const OpenGl_Structure* theStruct, if (!isForChangePriority) { - if (theStruct->IsAlwaysRendered()) + Standard_Boolean isAlwaysRend = theStruct->IsAlwaysRendered(); + if (!isAlwaysRend) + { + if (!myBVHPrimitives.Remove (theStruct)) + { + if (!myBVHPrimitivesTrsfPers.Remove (theStruct)) + { + isAlwaysRend = Standard_True; + } + } + } + if (isAlwaysRend) { const Standard_Integer anIndex2 = myAlwaysRenderedMap.FindIndex (theStruct); if (anIndex2 != 0) @@ -117,13 +128,6 @@ bool OpenGl_Layer::Remove (const OpenGl_Structure* theStruct, myAlwaysRenderedMap.RemoveLast(); } } - else - { - if (!myBVHPrimitives.Remove (theStruct)) - { - myBVHPrimitivesTrsfPers.Remove (theStruct); - } - } } --myNbStructures; thePriority = aPriorityIter; diff --git a/tests/bugs/vis/bug28093 b/tests/bugs/vis/bug28093 new file mode 100644 index 0000000000..e55f517a05 --- /dev/null +++ b/tests/bugs/vis/bug28093 @@ -0,0 +1,18 @@ +puts "===========" +puts "OCC28093" +puts "Visualization - access violation on removal of dynamic highlighting after device loss" +puts "===========" +puts "" + +pload MODELING VISUALIZATION +box b 1 2 3 +vclear +vinit View1 +vdisplay -dispMode 1 -highMode 1 b +vfit + +vmoveto 250 250 +vraytrace 1 +vmoveto 400 400 + +vdump $imagedir/${casename}.png