Fix a long calculation time that happens with some gerber files when closing Gerbview in legacy display mode.

This commit is contained in:
jean-pierre charras 2018-03-19 10:39:11 +01:00
parent ce610f33a2
commit 5e34563f52
1 changed files with 6 additions and 4 deletions

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
@ -284,6 +284,8 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
GERBVIEW_FRAME::~GERBVIEW_FRAME() GERBVIEW_FRAME::~GERBVIEW_FRAME()
{ {
GetGalCanvas()->GetView()->Clear();
GetGerberLayout()->GetImagesList()->DeleteAllImages(); GetGerberLayout()->GetImagesList()->DeleteAllImages();
delete m_gerberLayout; delete m_gerberLayout;
} }
@ -291,18 +293,18 @@ GERBVIEW_FRAME::~GERBVIEW_FRAME()
void GERBVIEW_FRAME::OnCloseWindow( wxCloseEvent& Event ) void GERBVIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
{ {
GetGalCanvas()->GetView()->Clear();
GetGalCanvas()->StopDrawing();
if( m_toolManager ) if( m_toolManager )
m_toolManager->DeactivateTool(); m_toolManager->DeactivateTool();
if( IsGalCanvasActive() ) if( IsGalCanvasActive() )
{ {
GetGalCanvas()->GetView()->Clear();
// Be sure any OpenGL event cannot be fired after frame deletion: // Be sure any OpenGL event cannot be fired after frame deletion:
GetGalCanvas()->SetEvtHandlerEnabled( false ); GetGalCanvas()->SetEvtHandlerEnabled( false );
} }
GetGalCanvas()->StopDrawing();
Destroy(); Destroy();
} }