mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
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.
This commit is contained in:
@ -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();
|
||||
|
Reference in New Issue
Block a user