From 5f2ae7a9ba0df2e12103a86cce94702828306ef6 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 25 Nov 2021 09:00:59 +0100 Subject: [PATCH] #8290 commandFile: Crash for scaleFractureTemplate Make sure closeProject() is called before application exit. If not, some field editors will remain open an cause assert and crash on shutdown. --- ApplicationExeCode/RiaMain.cpp | 6 ++++++ ApplicationLibCode/Application/RiaGuiApplication.cpp | 2 -- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ApplicationExeCode/RiaMain.cpp b/ApplicationExeCode/RiaMain.cpp index 2a05d22679..7e158905aa 100644 --- a/ApplicationExeCode/RiaMain.cpp +++ b/ApplicationExeCode/RiaMain.cpp @@ -109,10 +109,16 @@ int main( int argc, char* argv[] ) if ( status == RiaApplication::ApplicationStatus::EXIT_COMPLETED ) { + // Make sure project is closed to avoid assert and crash in destruction of widgets + app->closeProject(); + return 0; } else if ( status == RiaApplication::ApplicationStatus::EXIT_WITH_ERROR ) { + // Make sure project is closed to avoid assert and crash in destruction of widgets + app->closeProject(); + return 2; } else if ( status == RiaApplication::ApplicationStatus::KEEP_GOING ) diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index 0d2ce98f96..f14eb7da0e 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -776,8 +776,6 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( gsl::not_n RiuMainWindow::instance()->loadWinGeoAndDockToolBarLayout(); - closeProject(); - return ApplicationStatus::EXIT_COMPLETED; }