0028061: Samples - Highlighting of any object with "Hidden On" option leads to crash...
authorvpa <vpa@opencascade.com>
Wed, 9 Nov 2016 14:55:51 +0000 (17:55 +0300)
committerapn <apn@opencascade.com>
Thu, 17 Nov 2016 11:54:24 +0000 (14:54 +0300)
Graphic3d_Structure::Highlight() does not call UnHighlight() anymore.

src/Graphic3d/Graphic3d_Structure.cxx
src/OpenGl/OpenGl_Structure.cxx
tests/bugs/vis/bug28061 [new file with mode: 0644]

index ed6ba43..1137993 100644 (file)
@@ -262,24 +262,6 @@ void Graphic3d_Structure::Highlight (const Handle(Graphic3d_HighlightStyle)& the
     return;
   }
 
-  // Highlight on already Highlighted structure.
-  if (myCStructure->highlight)
-  {
-    Aspect_TypeOfUpdate anUpdateMode = myStructureManager->UpdateMode();
-    if (anUpdateMode == Aspect_TOU_WAIT)
-    {
-      UnHighlight();
-    }
-    else
-    {
-      // To avoid call of method : Update()
-      // Not useful and can be costly.
-      myStructureManager->SetUpdateMode (Aspect_TOU_WAIT);
-      UnHighlight();
-      myStructureManager->SetUpdateMode (anUpdateMode);
-    }
-  }
-
   SetDisplayPriority (Structure_MAX_PRIORITY - 1);
 
   myCStructure->GraphicHighlight (theStyle, this);
index 436a2e3..9e12749 100644 (file)
@@ -245,6 +245,14 @@ void OpenGl_Structure::highlightWithBndBox (const Handle(Graphic3d_Structure)& t
 void OpenGl_Structure::GraphicHighlight (const Handle(Graphic3d_HighlightStyle)& theStyle,
                                          const Handle(Graphic3d_Structure)&      theStruct)
 {
+  if (!myHighlightStyle.IsNull()
+    && myHighlightStyle->Method() == Aspect_TOHM_BOUNDBOX
+    && theStyle->Method() != Aspect_TOHM_BOUNDBOX)
+  {
+    const Handle(OpenGl_Context)& aContext = GlDriver()->GetSharedContext();
+    clearHighlightBox (aContext);
+  }
+
   myHighlightStyle = theStyle;
 
   highlight = 1;
diff --git a/tests/bugs/vis/bug28061 b/tests/bugs/vis/bug28061
new file mode 100644 (file)
index 0000000..0f5f6c9
--- /dev/null
@@ -0,0 +1,19 @@
+puts "==========="
+puts "OCC28061 - Highlighting of any object with HLR option leads to crash"
+puts "==========="
+puts ""
+
+pload MODELING VISUALIZATION
+box b 1 2 3
+
+vclear
+vinit View1
+vdisplay -dispMode 0 b
+vsetwidth -noupdate b 4
+vfit
+vhlr on
+
+vmoveto 250 250
+if { [vreadpixel 321 150 rgb name] != "CYAN1" } { puts "Error: the box is not highlighted" }
+
+vdump $imagedir/${casename}.png