Use TerminateTitle rather than relying on XamLoader* being called from the main thread.

This commit is contained in:
Dr. Chat 2015-07-05 16:22:45 -05:00
parent ff72a25260
commit 82986c6eec
2 changed files with 5 additions and 2 deletions

View File

@ -312,6 +312,7 @@ void KernelState::TerminateTitle(bool from_guest_thread) {
if (from_guest_thread && XThread::IsInThread(thread)) {
// Don't terminate ourselves.
++it;
continue;
}
@ -336,6 +337,8 @@ void KernelState::TerminateTitle(bool from_guest_thread) {
user_modules_.clear();
if (from_guest_thread) {
threads_by_id_.erase(XThread::GetCurrentThread()->thread_id());
// Now commit suicide (using Terminate, because we can't call into guest
// code anymore)
// Also, manually invoke the lock guard's destructor, because Terminate

View File

@ -170,13 +170,13 @@ void XamLoaderLaunchTitle(lpstring_t raw_name, dword_t flags) {
}
// This function does not return.
XThread::GetCurrentThread()->Exit(0);
kernel_state()->TerminateTitle(true);
}
DECLARE_XAM_EXPORT(XamLoaderLaunchTitle, ExportTag::kSketchy);
void XamLoaderTerminateTitle() {
// This function does not return.
XThread::GetCurrentThread()->Exit(0);
kernel_state()->TerminateTitle(true);
}
DECLARE_XAM_EXPORT(XamLoaderTerminateTitle, ExportTag::kSketchy);