video_core: Cancel Scoped's exit call on GPU failure
When CreateRenderer fails, the GraphicsContext that was std::move'd into it is destroyed before the Scoped that was created to manage its currency. In that case, the GraphicsContext::Scoped will still call its destructor at the ending of the function. And because the context is destroyed, the Scoped will cause a crash as it attempts to call a destroyed object's DoneCurrent function. Since we know when the call would be invalid, call the Scoped's Cancel method. This prevents it from calling a method on a destroyed object.
This commit is contained in:
parent
1f24a4e520
commit
b5e60ae1b0
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user