diff --git a/common/plotters/PDF_plotter.cpp b/common/plotters/PDF_plotter.cpp index 7b5e511b8f..1c31e027a8 100644 --- a/common/plotters/PDF_plotter.cpp +++ b/common/plotters/PDF_plotter.cpp @@ -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(), diff --git a/include/plotters/plotters_pslike.h b/include/plotters/plotters_pslike.h index 03ca781801..2da0189301 100644 --- a/include/plotters/plotters_pslike.h +++ b/include/plotters/plotters_pslike.h @@ -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 children; + std::vector 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 ) {