From 0e7db240496ca0e2de06a4c91996728f691ca56c Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 5 Dec 2013 14:54:30 +0100 Subject: [PATCH] Fixed SetCurrentContext() assert, that was firing on closure of pcbnew, when the OpenGL backend was active. --- common/drawpanel_gal.cpp | 7 +++++++ include/class_drawpanel_gal.h | 6 ++++++ pcbnew/pcbframe.cpp | 1 + 3 files changed, 14 insertions(+) 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() ) {