From 65008c5c0bbc2672f13f7603ee8ba8bd64c25333 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Tue, 10 Dec 2019 08:00:42 -0800 Subject: [PATCH] Eeschema: Check twice before using GAL The windows display may through an error which we need to catch when starting GAL under windows. This is a reimplementation of e39586e15 which cannot be cherry-picked into v5 Fixes #2620 | https://gitlab.com/kicad/code/kicad/issues/2620 --- eeschema/sch_draw_panel.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/eeschema/sch_draw_panel.cpp b/eeschema/sch_draw_panel.cpp index 0ad1f53bd2..80c4f7514b 100644 --- a/eeschema/sch_draw_panel.cpp +++ b/eeschema/sch_draw_panel.cpp @@ -23,10 +23,11 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - +#include #include #include +#include #include #include #include @@ -34,8 +35,6 @@ #include #include -#include - #include #include @@ -174,7 +173,19 @@ void SCH_DRAW_PANEL::DisplaySheet( const SCH_SCREEN *aScreen ) void SCH_DRAW_PANEL::OnShow() { - //m_view->RecacheAllItems(); + SCH_BASE_FRAME* frame = dynamic_cast( GetParent() ); + + try + { + // Check if the current rendering backend can be properly initialized + m_view->UpdateItems(); + } + catch( const std::runtime_error& e ) + { + // Fallback to software renderer + DisplayInfoMessage( frame, e.what() ); + SwitchBackend( GAL_TYPE_CAIRO ); + } }