1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +03:00

0024353: TKOpenGl - crash in IsRaytracedStructure when clearing mutli-connected presentation

Correction of test cases for issue CR24353
This commit is contained in:
kgv
2013-11-21 13:29:08 +04:00
committed by bugmaster
parent bf62b306ab
commit d5af86261d
5 changed files with 70 additions and 7 deletions

View File

@@ -146,7 +146,8 @@ OpenGl_RaytraceLight::OpenGl_RaytraceLight (const OpenGl_RTVec4f& theDiffuse,
// =======================================================================
OpenGl_RTVec4f OpenGl_RaytraceScene::Center (const int theTriangle) const
{
const OpenGl_RTVec4i anIndex (Triangles [theTriangle]);
const OpenGl_RTVec4i& anIndex = Triangles [theTriangle];
return ( Vertices[anIndex.x()] +
Vertices[anIndex.y()] +
Vertices[anIndex.z()] ) * ( 1.f / 3.f );
@@ -159,7 +160,8 @@ OpenGl_RTVec4f OpenGl_RaytraceScene::Center (const int theTriangle) const
float OpenGl_RaytraceScene::CenterAxis (const int theTriangle,
const int theAxis) const
{
const OpenGl_RTVec4i anIndex (Triangles [theTriangle]);
const OpenGl_RTVec4i& anIndex = Triangles [theTriangle];
return ( Vertices[anIndex.x()][theAxis] +
Vertices[anIndex.y()][theAxis] +
Vertices[anIndex.z()][theAxis] ) * ( 1.f / 3.f );
@@ -171,11 +173,11 @@ float OpenGl_RaytraceScene::CenterAxis (const int theTriangle,
// =======================================================================
OpenGl_AABB OpenGl_RaytraceScene::Box (const int theTriangle) const
{
const OpenGl_RTVec4i anIndex (Triangles[theTriangle]);
const OpenGl_RTVec4i& anIndex = Triangles[theTriangle];
const OpenGl_RTVec4f pA = Vertices[anIndex.x()];
const OpenGl_RTVec4f pB = Vertices[anIndex.y()];
const OpenGl_RTVec4f pC = Vertices[anIndex.z()];
const OpenGl_RTVec4f& pA = Vertices[anIndex.x()];
const OpenGl_RTVec4f& pB = Vertices[anIndex.y()];
const OpenGl_RTVec4f& pC = Vertices[anIndex.z()];
OpenGl_AABB aBox (pA);

View File

@@ -385,6 +385,27 @@ void OpenGl_Structure::UnregisterAncestorStructure (const OpenGl_Structure* theS
}
}
// =======================================================================
// function : UnregisterFromAncestorStructure
// purpose :
// =======================================================================
void OpenGl_Structure::UnregisterFromAncestorStructure() const
{
for (OpenGl_ListOfStructure::Iterator anIta (myAncestorStructures); anIta.More(); anIta.Next())
{
OpenGl_Structure* anAncestor = const_cast<OpenGl_Structure*> (anIta.ChangeValue());
for (OpenGl_ListOfStructure::Iterator anIts (anAncestor->myConnected); anIts.More(); anIts.Next())
{
if (anIts.Value() == this)
{
anAncestor->myConnected.Remove (anIts);
return;
}
}
}
}
// =======================================================================
// function : UpdateStateWithAncestorStructures
// purpose :
@@ -778,6 +799,11 @@ void OpenGl_Structure::Release (const Handle(OpenGl_Context)& theGlCtx)
OpenGl_Element::Destroy (theGlCtx, myAspectMarker);
OpenGl_Element::Destroy (theGlCtx, myAspectText);
ClearHighlightColor (theGlCtx);
#ifdef HAVE_OPENCL
// Remove from connected list of ancestor
UnregisterFromAncestorStructure();
#endif
}
// =======================================================================

View File

@@ -138,6 +138,9 @@ protected:
//! Unregisters ancestor connected structure (for updating ray-tracing state).
void UnregisterAncestorStructure (const OpenGl_Structure* theStructure) const;
//! Unregisters structure from ancestor structure (for updating ray-tracing state).
void UnregisterFromAncestorStructure() const;
//! Updates modification state for structure and its parents.
void UpdateStateWithAncestorStructures() const;

View File

@@ -47,7 +47,7 @@
using namespace OpenGl_Raytrace;
//! Use this macro to output ray-tracing debug info
// #define RAY_TRACE_PRINT_INFO
//#define RAY_TRACE_PRINT_INFO
#ifdef RAY_TRACE_PRINT_INFO
#include <OSD_Timer.hxx>