DInputSource: Fix incorrect unlock on failure

This commit is contained in:
Stenzek 2023-01-02 12:41:33 +10:00 committed by refractionpcsx2
parent 2de6a5029f
commit 2d7289a248
1 changed files with 2 additions and 1 deletions

View File

@ -96,12 +96,13 @@ bool DInputSource::Initialize(SettingsInterface& si, std::unique_lock<std::mutex
// need to release the lock while we're enumerating, because we call winId().
settings_lock.unlock();
const std::optional<WindowInfo> toplevel_wi(Host::GetTopLevelWindowInfo());
settings_lock.lock();
if (!toplevel_wi.has_value() || toplevel_wi->type != WindowInfo::Type::Win32)
{
Console.Error("Missing top level window, cannot add DInput devices.");
return false;
}
settings_lock.lock();
m_toplevel_window = static_cast<HWND>(toplevel_wi->window_handle);
ReloadDevices();