Browse Source
Merge pull request #7986 from lat9nq/vk-callback
core, video_core: Fix two crashes when failing to create the emulated GPU instance
pull/15/merge
bunnei
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
14 additions and
2 deletions
-
src/core/core.cpp
-
src/core/frontend/emu_window.h
-
src/video_core/video_core.cpp
|
|
@ -326,7 +326,9 @@ struct System::Impl { |
|
|
is_powered_on = false; |
|
|
is_powered_on = false; |
|
|
exit_lock = false; |
|
|
exit_lock = false; |
|
|
|
|
|
|
|
|
gpu_core->NotifyShutdown(); |
|
|
|
|
|
|
|
|
if (gpu_core != nullptr) { |
|
|
|
|
|
gpu_core->NotifyShutdown(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
services.reset(); |
|
|
services.reset(); |
|
|
service_manager.reset(); |
|
|
service_manager.reset(); |
|
|
|
|
|
@ -42,11 +42,20 @@ public: |
|
|
context.MakeCurrent(); |
|
|
context.MakeCurrent(); |
|
|
} |
|
|
} |
|
|
~Scoped() { |
|
|
~Scoped() { |
|
|
context.DoneCurrent(); |
|
|
|
|
|
|
|
|
if (active) { |
|
|
|
|
|
context.DoneCurrent(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// In the event that context was destroyed before the Scoped is destroyed, this provides a |
|
|
|
|
|
/// mechanism to prevent calling a destroyed object's method during the deconstructor |
|
|
|
|
|
void Cancel() { |
|
|
|
|
|
active = false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private: |
|
|
private: |
|
|
GraphicsContext& context; |
|
|
GraphicsContext& context; |
|
|
|
|
|
bool active{true}; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
/// Calls MakeCurrent on the context and calls DoneCurrent when the scope for the returned value |
|
|
/// Calls MakeCurrent on the context and calls DoneCurrent when the scope for the returned value |
|
|
|
|
|
@ -50,6 +50,7 @@ std::unique_ptr<Tegra::GPU> CreateGPU(Core::Frontend::EmuWindow& emu_window, Cor |
|
|
gpu->BindRenderer(std::move(renderer)); |
|
|
gpu->BindRenderer(std::move(renderer)); |
|
|
return gpu; |
|
|
return gpu; |
|
|
} catch (const std::runtime_error& exception) { |
|
|
} catch (const std::runtime_error& exception) { |
|
|
|
|
|
scope.Cancel(); |
|
|
LOG_ERROR(HW_GPU, "Failed to initialize GPU: {}", exception.what()); |
|
|
LOG_ERROR(HW_GPU, "Failed to initialize GPU: {}", exception.what()); |
|
|
return nullptr; |
|
|
return nullptr; |
|
|
} |
|
|
} |
|
|
|