From ce3ef333b79dff616410feedd1a45285f0f2d3d0 Mon Sep 17 00:00:00 2001 From: berendi Date: Sun, 9 Mar 2025 12:35:21 +0100 Subject: [PATCH] call ResourceManager::Cleanup() on exit --- main.cpp | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/main.cpp b/main.cpp index 3e2d5cc7..9b06f0e9 100644 --- a/main.cpp +++ b/main.cpp @@ -162,6 +162,7 @@ void InstallWinRing0() int main(int argc, char* argv[]) { + int exitval = EXIT_SUCCESS; #ifdef _WIN32 /*---------------------------------------------------------*\ | Windows only - Attach console output | @@ -269,7 +270,7 @@ int main(int argc, char* argv[]) } LOG_TRACE("[main] Ready to exec() the dialog"); - return a.exec(); + exitval = a.exec(); } else { @@ -286,25 +287,18 @@ int main(int argc, char* argv[]) if(!server->GetOnline()) { -#ifdef _MACOSX_X86_X64 - CloseMacUSPCIODriver(); -#endif - return 1; + exitval = EXIT_FAILURE; } else { WaitWhileServerOnline(server); -#ifdef _MACOSX_X86_X64 - CloseMacUSPCIODriver(); -#endif } } - else - { -#ifdef _MACOSX_X86_X64 - CloseMacUSPCIODriver(); -#endif - return 0; - } } + ResourceManager::get()->Cleanup(); +#ifdef _MACOSX_X86_X64 + CloseMacUSPCIODriver(); +#endif + LOG_TRACE("OpenRGB finishing with exit code %d", exitval); + return exitval; }