From 6b03b26364cbae5c6d7c1ef6668f1ebb2c0cd3e3 Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Sat, 1 May 2021 14:14:57 -0400 Subject: [PATCH] Actually ensure we cleanup in case of failure in dialog_page_settings --- common/dialogs/dialog_page_settings.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/dialogs/dialog_page_settings.cpp b/common/dialogs/dialog_page_settings.cpp index 2e8fd0e86d..28bbab9149 100644 --- a/common/dialogs/dialog_page_settings.cpp +++ b/common/dialogs/dialog_page_settings.cpp @@ -806,7 +806,7 @@ void DIALOG_PAGES_SETTINGS::OnWksFileSelection( wxCommandEvent& event ) shortFileName = fileName; } - DS_DATA_MODEL* ws = new DS_DATA_MODEL; + std::unique_ptr ws = std::make_unique(); if( ws->LoadDrawingSheet( fileName ) ) { @@ -815,7 +815,7 @@ void DIALOG_PAGES_SETTINGS::OnWksFileSelection( wxCommandEvent& event ) delete m_drawingSheet; } - m_drawingSheet = ws; + m_drawingSheet = ws.release(); SetWksFileName( shortFileName );