Fix assertion failure quitting gerbview

Fixes: lp:1744600
https://bugs.launchpad.net/kicad/+bug/1744600
This commit is contained in:
jean-pierre charras 2018-01-22 21:15:46 +01:00
parent 6b9a286a85
commit 61193dcd13
1 changed files with 12 additions and 8 deletions

View File

@ -280,14 +280,6 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
GERBVIEW_FRAME::~GERBVIEW_FRAME()
{
if( m_toolManager )
m_toolManager->DeactivateTool();
if( auto canvas = GetGalCanvas() )
{
canvas->GetView()->Clear();
}
GetGerberLayout()->GetImagesList()->DeleteAllImages();
delete m_gerberLayout;
}
@ -295,6 +287,18 @@ GERBVIEW_FRAME::~GERBVIEW_FRAME()
void GERBVIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
{
if( m_toolManager )
m_toolManager->DeactivateTool();
if( IsGalCanvasActive() )
{
GetGalCanvas()->GetView()->Clear();
// Be sure any OpenGL event cannot be fired after frame deletion:
GetGalCanvas()->SetEvtHandlerEnabled( false );
}
GetGalCanvas()->StopDrawing();
Destroy();
}