Fix exit behavior and memory leak in pl_editor
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4887
This commit is contained in:
parent
ad99d85390
commit
eb37c89a7b
|
@ -87,6 +87,8 @@ void PL_DRAW_PANEL_GAL::DisplayWorksheet()
|
|||
selTool->GetSelection().Clear();
|
||||
m_view->Clear();
|
||||
|
||||
m_pageDrawItem.reset();
|
||||
|
||||
// Obviously, always show the page limit:
|
||||
m_edaFrame->SetShowPageLimits( true );
|
||||
auto painter = m_view->GetPainter();
|
||||
|
@ -110,8 +112,8 @@ void PL_DRAW_PANEL_GAL::DisplayWorksheet()
|
|||
// Not also this item has no peer in WS_DATA_MODEL list.
|
||||
const int penWidth = 0; // This value is to use the default thickness line
|
||||
constexpr double markerSize = Millimeter2iu( 5 );
|
||||
WS_DRAW_ITEM_PAGE* pageDrawing = new WS_DRAW_ITEM_PAGE( penWidth, markerSize );
|
||||
m_view->Add( pageDrawing );
|
||||
m_pageDrawItem = std::make_unique<WS_DRAW_ITEM_PAGE>( penWidth, markerSize );
|
||||
m_view->Add( m_pageDrawItem.get() );
|
||||
|
||||
selTool->RebuildSelection();
|
||||
|
||||
|
@ -125,9 +127,9 @@ void PL_DRAW_PANEL_GAL::DisplayWorksheet()
|
|||
VECTOR2D( size_x * 1.5, size_y * 1.5) );
|
||||
m_view->SetBoundary( boundary );
|
||||
|
||||
pageDrawing->SetPageSize( m_edaFrame->GetPageSizeIU() );
|
||||
m_pageDrawItem->SetPageSize( m_edaFrame->GetPageSizeIU() );
|
||||
wxPoint originCoord = static_cast<PL_EDITOR_FRAME*>( m_edaFrame )->ReturnCoordOriginCorner();
|
||||
pageDrawing->SetMarkerPos( originCoord );
|
||||
m_pageDrawItem->SetMarkerPos( originCoord );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -54,6 +54,8 @@ protected:
|
|||
|
||||
///> Currently used worksheet
|
||||
std::unique_ptr<KIGFX::WS_PROXY_VIEW_ITEM> m_worksheet;
|
||||
|
||||
std::unique_ptr<WS_DRAW_ITEM_PAGE> m_pageDrawItem;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -300,6 +300,9 @@ void PL_EDITOR_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
|
|||
// do not show the window because we do not want any paint event
|
||||
Show( false );
|
||||
|
||||
// clean up the data before the view is destroyed
|
||||
WS_DATA_MODEL::GetTheInstance().ClearList();
|
||||
|
||||
// On Linux, m_propertiesPagelayout must be destroyed
|
||||
// before deleting the main frame to avoid a crash when closing
|
||||
m_propertiesPagelayout->Destroy();
|
||||
|
|
Loading…
Reference in New Issue