mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-09 18:45:40 +00:00
WinUpdater: Improved exit synchronization on Windows - now joins a thread instead of using flags to signal
This commit is contained in:
parent
3f1ba830e7
commit
d355abaf0c
@ -12,7 +12,6 @@
|
|||||||
#include <ShObjIdl.h>
|
#include <ShObjIdl.h>
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
|
|
||||||
#include "Common/Flag.h"
|
|
||||||
#include "Common/StringUtil.h"
|
#include "Common/StringUtil.h"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@ -23,7 +22,7 @@ HWND total_progressbar_handle = nullptr;
|
|||||||
HWND current_progressbar_handle = nullptr;
|
HWND current_progressbar_handle = nullptr;
|
||||||
ITaskbarList3* taskbar_list = nullptr;
|
ITaskbarList3* taskbar_list = nullptr;
|
||||||
|
|
||||||
Common::Flag running;
|
std::thread ui_thread;
|
||||||
|
|
||||||
int GetWindowHeight(HWND hwnd)
|
int GetWindowHeight(HWND hwnd)
|
||||||
{
|
{
|
||||||
@ -201,12 +200,16 @@ void SetDescription(const std::string& text)
|
|||||||
|
|
||||||
void MessageLoop()
|
void MessageLoop()
|
||||||
{
|
{
|
||||||
running.Set();
|
|
||||||
|
|
||||||
if (!InitWindow())
|
if (!InitWindow())
|
||||||
{
|
{
|
||||||
running.Clear();
|
|
||||||
MessageBox(nullptr, L"Window init failed!", L"", MB_ICONERROR);
|
MessageBox(nullptr, L"Window init failed!", L"", MB_ICONERROR);
|
||||||
|
// Destroying the parent (if exists) destroys all children windows
|
||||||
|
if (window_handle)
|
||||||
|
{
|
||||||
|
DestroyWindow(window_handle);
|
||||||
|
window_handle = nullptr;
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetTotalMarquee(true);
|
SetTotalMarquee(true);
|
||||||
@ -218,26 +221,19 @@ void MessageLoop()
|
|||||||
TranslateMessage(&msg);
|
TranslateMessage(&msg);
|
||||||
DispatchMessage(&msg);
|
DispatchMessage(&msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
running.Clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Init()
|
void Init()
|
||||||
{
|
{
|
||||||
std::thread thread(MessageLoop);
|
ui_thread = std::thread(MessageLoop);
|
||||||
thread.detach();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stop()
|
void Stop()
|
||||||
{
|
{
|
||||||
if (!running.IsSet())
|
if (window_handle)
|
||||||
return;
|
PostMessage(window_handle, WM_CLOSE, 0, 0);
|
||||||
|
|
||||||
PostMessage(window_handle, WM_CLOSE, 0, 0);
|
ui_thread.join();
|
||||||
|
|
||||||
while (running.IsSet())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaunchApplication(std::string path)
|
void LaunchApplication(std::string path)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user