From 33385d0bb0469c6526ffc187dbf85adb7827168a Mon Sep 17 00:00:00 2001 From: Roberto Fernandez Bautista Date: Fri, 30 Oct 2020 18:58:26 +0000 Subject: [PATCH] Combine return statements in OPENGL_GAL::CheckFeatures --- common/gal/opengl/opengl_gal.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index c6eab4a7f0..9ee476a4d5 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -327,8 +327,11 @@ OPENGL_GAL::~OPENGL_GAL() wxString OPENGL_GAL::CheckFeatures( GAL_DISPLAY_OPTIONS& aOptions ) { + wxString retVal = wxEmptyString; + wxFrame* testFrame = new wxFrame( NULL, wxID_ANY, wxT( "" ), wxDefaultPosition, wxSize( 1, 1 ), - wxFRAME_TOOL_WINDOW | wxNO_BORDER ); + wxFRAME_TOOL_WINDOW | wxNO_BORDER ); + KIGFX::OPENGL_GAL* opengl_gal = new KIGFX::OPENGL_GAL( aOptions, testFrame ); testFrame->Raise(); @@ -342,15 +345,13 @@ wxString OPENGL_GAL::CheckFeatures( GAL_DISPLAY_OPTIONS& aOptions ) catch( std::runtime_error& err ) { //Test failed - delete opengl_gal; - delete testFrame; - return wxString( err.what() ); + retVal = wxString( err.what() ); } - //Test passed delete opengl_gal; delete testFrame; - return wxEmptyString; + + return retVal; }