diff --git a/common/drawpanel_gal.cpp b/common/drawpanel_gal.cpp index 3ec9568fde..aa30b5ba92 100644 --- a/common/drawpanel_gal.cpp +++ b/common/drawpanel_gal.cpp @@ -184,6 +184,13 @@ void EDA_DRAW_PANEL_GAL::Refresh( bool eraseBackground, const wxRect* rect ) } +void EDA_DRAW_PANEL_GAL::StopDrawing() +{ + Disconnect( wxEVT_PAINT, wxPaintEventHandler( EDA_DRAW_PANEL_GAL::onPaint ), NULL, this ); + m_refreshTimer.Stop(); +} + + void EDA_DRAW_PANEL_GAL::SwitchBackend( GalType aGalType ) { // Protect from refreshing during backend switch diff --git a/include/class_drawpanel_gal.h b/include/class_drawpanel_gal.h index 4d9acac711..b7f92c2209 100644 --- a/include/class_drawpanel_gal.h +++ b/include/class_drawpanel_gal.h @@ -111,6 +111,12 @@ public: m_eventDispatcher = aEventDispatcher; } + /** + * Function StopDrawing() + * Prevents the GAL canvas from further drawing till it is recreated. + */ + void StopDrawing(); + protected: void onPaint( wxPaintEvent& WXUNUSED( aEvent ) ); void onSize( wxSizeEvent& aEvent ); diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index b6a2a2c2d5..a9a05b94db 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -556,6 +556,7 @@ void PCB_EDIT_FRAME::OnQuit( wxCommandEvent& event ) void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event ) { m_canvas->SetAbortRequest( true ); + m_galCanvas->StopDrawing(); if( GetScreen()->IsModify() ) {