Merge pull request #209 from MerryMage/f/scheduler-shutdown

core: Fix scheduler-shutdown related crash
This commit is contained in:
bunnei 2018-02-22 01:07:54 -05:00 committed by GitHub
commit fa28dbe0f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -139,6 +139,8 @@ void System::Reschedule() {
System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) { System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) {
LOG_DEBUG(HW_Memory, "initialized OK"); LOG_DEBUG(HW_Memory, "initialized OK");
CoreTiming::Init();
switch (Settings::values.cpu_core) { switch (Settings::values.cpu_core) {
case Settings::CpuCore::Unicorn: case Settings::CpuCore::Unicorn:
cpu_core = std::make_shared<ARM_Unicorn>(); cpu_core = std::make_shared<ARM_Unicorn>();
@ -154,14 +156,13 @@ System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) {
break; break;
} }
scheduler = std::make_unique<Kernel::Scheduler>(cpu_core.get());
gpu_core = std::make_unique<Tegra::GPU>(); gpu_core = std::make_unique<Tegra::GPU>();
telemetry_session = std::make_unique<Core::TelemetrySession>(); telemetry_session = std::make_unique<Core::TelemetrySession>();
CoreTiming::Init();
HW::Init(); HW::Init();
Kernel::Init(system_mode); Kernel::Init(system_mode);
scheduler = std::make_unique<Kernel::Scheduler>(cpu_core.get());
Service::Init(); Service::Init();
GDBStub::Init(); GDBStub::Init();
@ -189,15 +190,18 @@ void System::Shutdown() {
perf_results.frametime * 1000.0); perf_results.frametime * 1000.0);
// Shutdown emulation session // Shutdown emulation session
GDBStub::Shutdown();
VideoCore::Shutdown(); VideoCore::Shutdown();
GDBStub::Shutdown();
Service::Shutdown(); Service::Shutdown();
scheduler = nullptr;
Kernel::Shutdown(); Kernel::Shutdown();
HW::Shutdown(); HW::Shutdown();
CoreTiming::Shutdown();
cpu_core = nullptr;
app_loader = nullptr;
telemetry_session = nullptr; telemetry_session = nullptr;
gpu_core = nullptr;
cpu_core = nullptr;
CoreTiming::Shutdown();
app_loader = nullptr;
LOG_DEBUG(Core, "Shutdown OK"); LOG_DEBUG(Core, "Shutdown OK");
} }