From 945faba586d3f840e8557722ac4f29b7df590909 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 28 Jan 2021 10:55:24 -0800 Subject: [PATCH] Wrap CTOR in try/catch for context errors --- common/gal/opengl/opengl_gal.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index e04d7fd759..cec436f947 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -332,13 +332,15 @@ wxString OPENGL_GAL::CheckFeatures( GAL_DISPLAY_OPTIONS& aOptions ) wxFrame* testFrame = new wxFrame( NULL, wxID_ANY, wxT( "" ), wxDefaultPosition, wxSize( 1, 1 ), wxFRAME_TOOL_WINDOW | wxNO_BORDER ); - KIGFX::OPENGL_GAL* opengl_gal = new KIGFX::OPENGL_GAL( aOptions, testFrame ); - - testFrame->Raise(); - testFrame->Show(); + KIGFX::OPENGL_GAL* opengl_gal = nullptr; try { + opengl_gal = new KIGFX::OPENGL_GAL( aOptions, testFrame ); + + testFrame->Raise(); + testFrame->Show(); + GAL_CONTEXT_LOCKER lock( opengl_gal ); opengl_gal->init(); }