]> OCCT Git - occt.git/commitdiff
0028093: Visualization - access violation on removal of dynamic highlighting after...
authorkgv <kgv@opencascade.com>
Fri, 11 Nov 2016 15:20:49 +0000 (18:20 +0300)
committerapn <apn@opencascade.com>
Thu, 17 Nov 2016 12:32:47 +0000 (15:32 +0300)
OpenGl_Layer::Remove() now tries to remove object from myAlwaysRenderedMap
if it was not removed from other groups.

src/OpenGl/OpenGl_Layer.cxx
tests/bugs/vis/bug28093 [new file with mode: 0644]

index 24585779bd6a015487ad448e6bc0efde217a15db..6b6c05e3a215769b6c53c9e03d73cd5ad89eea6e 100644 (file)
@@ -108,20 +108,24 @@ bool OpenGl_Layer::Remove (const OpenGl_Structure* theStruct,
 
       if (!isForChangePriority)
       {
-        if (theStruct->IsAlwaysRendered())
+        Standard_Boolean isAlwaysRend = theStruct->IsAlwaysRendered();
+        if (!isAlwaysRend)
         {
-          const Standard_Integer anIndex2 = myAlwaysRenderedMap.FindIndex (theStruct);
-          if (anIndex2 != 0)
+          if (!myBVHPrimitives.Remove (theStruct))
           {
-            myAlwaysRenderedMap.Swap (myAlwaysRenderedMap.Size(), anIndex2);
-            myAlwaysRenderedMap.RemoveLast();
+            if (!myBVHPrimitivesTrsfPers.Remove (theStruct))
+            {
+              isAlwaysRend = Standard_True;
+            }
           }
         }
-        else
+        if (isAlwaysRend)
         {
-          if (!myBVHPrimitives.Remove (theStruct))
+          const Standard_Integer anIndex2 = myAlwaysRenderedMap.FindIndex (theStruct);
+          if (anIndex2 != 0)
           {
-            myBVHPrimitivesTrsfPers.Remove (theStruct);
+            myAlwaysRenderedMap.Swap (myAlwaysRenderedMap.Size(), anIndex2);
+            myAlwaysRenderedMap.RemoveLast();
           }
         }
       }
diff --git a/tests/bugs/vis/bug28093 b/tests/bugs/vis/bug28093
new file mode 100644 (file)
index 0000000..e55f517
--- /dev/null
@@ -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