3D-Viewer: properly clears the container
Fixes https://gitlab.com/kicad/code/kicad/issues/6346
This commit is contained in:
parent
2a3e6ee1b5
commit
c08f9ac9f6
|
@ -55,7 +55,6 @@ void CGENERICCONTAINER2D::Clear()
|
||||||
++ii )
|
++ii )
|
||||||
{
|
{
|
||||||
delete *ii;
|
delete *ii;
|
||||||
*ii = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_objects.clear();
|
m_objects.clear();
|
||||||
|
@ -247,6 +246,12 @@ bool CBVHCONTAINER2D::IsPointInside( const SFVEC2F &aPoint ) const
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void CBVHCONTAINER2D::Clear()
|
||||||
|
{
|
||||||
|
CGENERICCONTAINER2D::Clear();
|
||||||
|
destroy();
|
||||||
|
}
|
||||||
|
|
||||||
void CBVHCONTAINER2D::destroy()
|
void CBVHCONTAINER2D::destroy()
|
||||||
{
|
{
|
||||||
for( std::list<BVH_CONTAINER_NODE_2D *>::iterator ii = m_elements_to_delete.begin();
|
for( std::list<BVH_CONTAINER_NODE_2D *>::iterator ii = m_elements_to_delete.begin();
|
||||||
|
@ -254,10 +259,9 @@ void CBVHCONTAINER2D::destroy()
|
||||||
++ii )
|
++ii )
|
||||||
{
|
{
|
||||||
delete *ii;
|
delete *ii;
|
||||||
*ii = NULL;
|
|
||||||
}
|
}
|
||||||
m_elements_to_delete.clear();
|
m_elements_to_delete.clear();
|
||||||
|
m_Tree = nullptr;
|
||||||
m_isInitialized = false;
|
m_isInitialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,6 +389,8 @@ void CBVHCONTAINER2D::recursiveBuild_MIDDLE_SPLIT( BVH_CONTAINER_NODE_2D *aNodeP
|
||||||
|
|
||||||
recursiveBuild_MIDDLE_SPLIT( leftNode );
|
recursiveBuild_MIDDLE_SPLIT( leftNode );
|
||||||
recursiveBuild_MIDDLE_SPLIT( rightNode );
|
recursiveBuild_MIDDLE_SPLIT( rightNode );
|
||||||
|
|
||||||
|
wxASSERT( aNodeParent->m_LeafList.size() == 0 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -392,6 +398,9 @@ void CBVHCONTAINER2D::recursiveBuild_MIDDLE_SPLIT( BVH_CONTAINER_NODE_2D *aNodeP
|
||||||
aNodeParent->m_Children[0] = NULL;
|
aNodeParent->m_Children[0] = NULL;
|
||||||
aNodeParent->m_Children[1] = NULL;
|
aNodeParent->m_Children[1] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxASSERT( aNodeParent != NULL );
|
||||||
|
wxASSERT( aNodeParent->m_BBox.IsInitialized() == true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ public:
|
||||||
return m_bbox;
|
return m_bbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clear();
|
virtual void Clear();
|
||||||
|
|
||||||
const LIST_OBJECT2D &GetList() const { return m_objects; }
|
const LIST_OBJECT2D &GetList() const { return m_objects; }
|
||||||
|
|
||||||
|
@ -119,6 +119,7 @@ public:
|
||||||
|
|
||||||
void BuildBVH();
|
void BuildBVH();
|
||||||
|
|
||||||
|
void Clear();
|
||||||
private:
|
private:
|
||||||
bool m_isInitialized;
|
bool m_isInitialized;
|
||||||
std::list<BVH_CONTAINER_NODE_2D *> m_elements_to_delete;
|
std::list<BVH_CONTAINER_NODE_2D *> m_elements_to_delete;
|
||||||
|
|
Loading…
Reference in New Issue