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
This commit is contained in:
Seth Hillbrand 2019-12-10 08:00:42 -08:00
parent dbfaf568fc
commit 65008c5c0b
1 changed files with 15 additions and 4 deletions

View File

@ -23,10 +23,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <functional>
#include <view/wx_view_controls.h>
#include <worksheet_viewitem.h>
#include <confirm.h>
#include <gal/graphics_abstraction_layer.h>
#include <sch_draw_panel.h>
#include <sch_view.h>
@ -34,8 +35,6 @@
#include <sch_edit_frame.h>
#include <preview_items/selection_area.h>
#include <functional>
#include <sch_sheet.h>
#include <pgm_base.h>
@ -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<SCH_BASE_FRAME*>( 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 );
}
}