mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-19 06:40:58 +00:00
WinUpdater: Wait in UI::Init until window is done creating to avoid losing UI::SetVisible signals
This commit is contained in:
parent
f70efbb963
commit
8e79705854
@ -12,6 +12,8 @@
|
||||
#include <ShObjIdl.h>
|
||||
#include <shellapi.h>
|
||||
|
||||
#include "Common/Event.h"
|
||||
#include "Common/ScopeGuard.h"
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
namespace
|
||||
@ -23,6 +25,7 @@ HWND current_progressbar_handle = nullptr;
|
||||
ITaskbarList3* taskbar_list = nullptr;
|
||||
|
||||
std::thread ui_thread;
|
||||
Common::Event window_created_event;
|
||||
|
||||
int GetWindowHeight(HWND hwnd)
|
||||
{
|
||||
@ -54,6 +57,9 @@ bool InitWindow()
|
||||
{
|
||||
InitCommonControls();
|
||||
|
||||
// Notify main thread we're done creating the window when we return
|
||||
Common::ScopeGuard ui_guard{[] { window_created_event.Set(); }};
|
||||
|
||||
WNDCLASS wndcl = {};
|
||||
wndcl.lpfnWndProc = WindowProc;
|
||||
wndcl.hbrBackground = GetSysColorBrush(COLOR_MENU);
|
||||
@ -226,6 +232,9 @@ void MessageLoop()
|
||||
void Init()
|
||||
{
|
||||
ui_thread = std::thread(MessageLoop);
|
||||
|
||||
// Wait for UI thread to finish creating the window (or at least attempting to)
|
||||
window_created_event.Wait();
|
||||
}
|
||||
|
||||
void Stop()
|
||||
|
Loading…
x
Reference in New Issue
Block a user