mirror of
https://github.com/wiiu-env/homebrew_on_menu_plugin.git
synced 2024-11-22 02:29:15 +01:00
Make sure to clean up open file handles when the SD Card was ejected
This commit is contained in:
parent
cd212a9314
commit
fd26902e87
@ -99,6 +99,10 @@ void Cleanup() {
|
||||
}
|
||||
}
|
||||
|
||||
void SDCleanUpHandlesHandler() {
|
||||
Cleanup();
|
||||
}
|
||||
|
||||
void SDAttachedHandler([[maybe_unused]] SDUtilsAttachStatus status) {
|
||||
if (!sTitleRebooting) {
|
||||
_SYSLaunchTitleWithStdArgsInNoSplash(OSGetTitleID(), nullptr);
|
||||
@ -123,6 +127,9 @@ ON_APPLICATION_START() {
|
||||
if (SDUtils_AddAttachHandler(SDAttachedHandler) != SDUTILS_RESULT_SUCCESS) {
|
||||
DEBUG_FUNCTION_LINE_ERR("Failed to add AttachedHandler");
|
||||
}
|
||||
if (SDUtils_AddCleanUpHandlesHandler(SDCleanUpHandlesHandler) != SDUTILS_RESULT_SUCCESS) {
|
||||
DEBUG_FUNCTION_LINE_ERR("Failed to add CleanUpHandlesHandler");
|
||||
}
|
||||
if (SDUtils_IsSdCardMounted(&sSDIsMounted) != SDUTILS_RESULT_SUCCESS) {
|
||||
DEBUG_FUNCTION_LINE_ERR("IsSdCardMounted failed");
|
||||
}
|
||||
@ -145,6 +152,7 @@ ON_APPLICATION_ENDS() {
|
||||
gInWiiUMenu = false;
|
||||
if (sSDUtilsInitDone) {
|
||||
SDUtils_RemoveAttachHandler(SDAttachedHandler);
|
||||
SDUtils_RemoveCleanUpHandlesHandler(SDCleanUpHandlesHandler);
|
||||
SDUtils_DeInit();
|
||||
sSDUtilsInitDone = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user