diff --git a/src/Graphic3d/Graphic3d_Structure.cxx b/src/Graphic3d/Graphic3d_Structure.cxx index ed6ba4366a..113799334d 100644 --- a/src/Graphic3d/Graphic3d_Structure.cxx +++ b/src/Graphic3d/Graphic3d_Structure.cxx @@ -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); diff --git a/src/OpenGl/OpenGl_Structure.cxx b/src/OpenGl/OpenGl_Structure.cxx index 436a2e3cef..9e12749317 100644 --- a/src/OpenGl/OpenGl_Structure.cxx +++ b/src/OpenGl/OpenGl_Structure.cxx @@ -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 index 0000000000..0f5f6c9e71 --- /dev/null +++ b/tests/bugs/vis/bug28061 @@ -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