Skip to content

Commit

Permalink
Prevent hangs on application exit
Browse files Browse the repository at this point in the history
  • Loading branch information
Nightkingale committed Apr 13, 2024
1 parent dfd23fc commit 1026f97
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,17 @@ std::string MII_NICKNAME;
std::string ACCOUNT_FILE;

void deinitialize() {
nn::act::Finalize();
Mocha_UnmountFS("storage_mlc");
Mocha_DeInitLibrary();
WHBLogConsoleFree();
WHBProcShutdown();
// This prevents hangs when called twice.
static bool isDeinitialized = false;

if (isDeinitialized) {
nn::act::Finalize();
Mocha_UnmountFS("storage_mlc");
Mocha_DeInitLibrary();
WHBLogConsoleFree();
WHBProcShutdown();
isDeinitialized = true;
}
}

void initialize() {
Expand Down

0 comments on commit 1026f97

Please sign in to comment.