diff options
| author | Dentomologist <dentomologist@gmail.com> | 2024-09-26 15:11:26 -0700 |
|---|---|---|
| committer | Dentomologist <dentomologist@gmail.com> | 2024-09-26 17:12:26 -0700 |
| commit | 0a1084fad58ca6e340802021bd2e0d48ad7180ed (patch) | |
| tree | 3dac50c3f1c5564a5d547eafa02f993db6233974 /Source/Core/VideoCommon/VideoBackendBase.cpp | |
| parent | 2b82c34ea81c673da4cac8227277a01021730c4d (diff) | |
VideoBackendBase: Check Core state in PopulateBackendInfo
Remove the PopulateBackendInfoFromUI function, which had a single caller
(GraphicsWindow::OnBackendChanged) and checked that the core wasn't
running or starting before calling PopulateBackendInfo.
Move the core state check into PopulateBackendInfo and have
OnBackendChanged call that instead. This guarantees the check is
performed by all callers of PopulateBackendInfo, preventing
potential reintroduction of the crash fixed in 3d4ae63f if another call
to PopulateBackendInfo is added.
As of the previous commit the only other caller of PopulateBackendInfo
is Core::Init shortly before s_state is set to Starting, so it will
always pass the check and so maintain its current behavior.
Diffstat (limited to 'Source/Core/VideoCommon/VideoBackendBase.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/VideoBackendBase.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/Source/Core/VideoCommon/VideoBackendBase.cpp b/Source/Core/VideoCommon/VideoBackendBase.cpp index 0bbc734e3b..ab5e6c9fe6 100644 --- a/Source/Core/VideoCommon/VideoBackendBase.cpp +++ b/Source/Core/VideoCommon/VideoBackendBase.cpp @@ -284,6 +284,11 @@ void VideoBackendBase::ActivateBackend(const std::string& name) void VideoBackendBase::PopulateBackendInfo(const WindowSystemInfo& wsi) { + // If the core is running, the backend info will have been populated already. If we did it here, + // the UI thread could race with the GPU thread. + if (Core::IsRunningOrStarting(Core::System::GetInstance())) + return; + g_Config.Refresh(); // Reset backend_info so if the backend forgets to initialize something it doesn't end up using // a value from the previously used renderer @@ -296,14 +301,6 @@ void VideoBackendBase::PopulateBackendInfo(const WindowSystemInfo& wsi) g_Config.VerifyValidity(); } -void VideoBackendBase::PopulateBackendInfoFromUI(const WindowSystemInfo& wsi) -{ - // If the core is running, the backend info will have been populated already. - // If we did it here, the UI thread can race with the with the GPU thread. - if (!Core::IsRunningOrStarting(Core::System::GetInstance())) - PopulateBackendInfo(wsi); -} - void VideoBackendBase::DoState(PointerWrap& p) { auto& system = Core::System::GetInstance(); |
