Add missing clear of children memory in outline node

This commit is contained in:
Marek Roszko 2022-09-25 08:45:08 -04:00
parent 7c44dbd9d6
commit 8f52821cd4
2 changed files with 15 additions and 6 deletions

View File

@ -840,9 +840,9 @@ void PDF_PLOTTER::ClosePage()
VECTOR2I bottomLeft = iuToPdfUserSpace( box.GetPosition() );
VECTOR2I topRight = iuToPdfUserSpace( box.GetEnd() );
int curr_actionHandle = emitGoToAction( pageHandle, bottomLeft, topRight );
actionHandle = emitGoToAction( pageHandle, bottomLeft, topRight );
addOutlineNode( groupOutlineNode, curr_actionHandle, ref );
addOutlineNode( groupOutlineNode, actionHandle, ref );
}
std::sort( groupOutlineNode->children.begin(), groupOutlineNode->children.end(),

View File

@ -367,11 +367,20 @@ public:
protected:
struct OUTLINE_NODE
{
int actionHandle; //< Handle to action
wxString title; //< Title of outline node
int entryHandle; //< Allocated handle for this outline entry
int actionHandle; ///< Handle to action
wxString title; ///< Title of outline node
int entryHandle; ///< Allocated handle for this outline entry
std::vector<OUTLINE_NODE*> children;
std::vector<OUTLINE_NODE*> children; ///< Ordered list of children
~OUTLINE_NODE()
{
std::for_each( children.begin(), children.end(),
[]( OUTLINE_NODE* node )
{
delete node;
} );
}
OUTLINE_NODE* AddChild( int aActionHandle, const wxString& aTitle, int aEntryHandle )
{