pm: fix racecond regression introduced by 7074ac1

It prevented games such as Mario & Luigi: Bowser's Inside Story from booting.

g_manager.runningApplicationData needs to be accessed through the lock.
This commit is contained in:
TuxSH 2023-01-09 14:22:37 +00:00
parent a812990f0d
commit 635235c86c

View File

@ -389,19 +389,25 @@ Result LaunchTitle(u32 *outPid, const FS_ProgramInfo *programInfo, u32 launchFla
Result LaunchTitleUpdate(const FS_ProgramInfo *programInfo, const FS_ProgramInfo *programInfoUpdate, u32 launchFlags) Result LaunchTitleUpdate(const FS_ProgramInfo *programInfo, const FS_ProgramInfo *programInfoUpdate, u32 launchFlags)
{ {
ProcessList_Lock(&g_manager.processList);
if (g_manager.preparingForReboot) { if (g_manager.preparingForReboot) {
ProcessList_Unlock(&g_manager.processList);
return 0xC8A05801; return 0xC8A05801;
} }
if (!(launchFlags & ~PMLAUNCHFLAG_NORMAL_APPLICATION)) {
return 0xD8E05802;
}
ProcessList_Lock(&g_manager.processList);
if (g_manager.runningApplicationData != NULL) { if (g_manager.runningApplicationData != NULL) {
ProcessList_Unlock(&g_manager.processList); ProcessList_Unlock(&g_manager.processList);
return 0xC8A05BF0; return 0xC8A05BF0;
} }
if (!(launchFlags & ~PMLAUNCHFLAG_NORMAL_APPLICATION)) {
ProcessList_Unlock(&g_manager.processList);
return 0xD8E05802;
}
ProcessList_Unlock(&g_manager.processList);
bool originallyDebugged = launchFlags & PMLAUNCHFLAG_QUEUE_DEBUG_APPLICATION; bool originallyDebugged = launchFlags & PMLAUNCHFLAG_QUEUE_DEBUG_APPLICATION;
launchFlags |= PMLAUNCHFLAG_USE_UPDATE_TITLE; launchFlags |= PMLAUNCHFLAG_USE_UPDATE_TITLE;