Moving threads to XHostThread and making shutdown not crash.
This commit is contained in:
@@ -17,6 +17,7 @@ Win32Control::Win32Control(uint32_t flags) : Control(flags), hwnd_(nullptr) {}
|
||||
|
||||
Win32Control::~Win32Control() {
|
||||
if (hwnd_) {
|
||||
SetWindowLongPtr(hwnd_, GWLP_USERDATA, 0);
|
||||
CloseWindow(hwnd_);
|
||||
hwnd_ = nullptr;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ class PostedFn {
|
||||
|
||||
Win32Loop::Win32Loop() : thread_id_(0) {
|
||||
xe::threading::Fence init_fence;
|
||||
thread_ = std::thread([&]() {
|
||||
thread_ = std::thread([&init_fence, this]() {
|
||||
xe::threading::set_name("Win32 Loop");
|
||||
thread_id_ = GetCurrentThreadId();
|
||||
|
||||
@@ -46,7 +46,10 @@ Win32Loop::Win32Loop() : thread_id_(0) {
|
||||
init_fence.Wait();
|
||||
}
|
||||
|
||||
Win32Loop::~Win32Loop() = default;
|
||||
Win32Loop::~Win32Loop() {
|
||||
Quit();
|
||||
thread_.join();
|
||||
}
|
||||
|
||||
void Win32Loop::ThreadMain() {
|
||||
MSG msg;
|
||||
|
||||
Reference in New Issue
Block a user