From 95df3ba28752b42bba41d677fa1d9acb7540e281 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Thu, 16 Jun 2022 14:33:49 +0200 Subject: [PATCH] Better window destruction --- src/client/component/splash.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/client/component/splash.cpp b/src/client/component/splash.cpp index b4a35a99..70208fd7 100644 --- a/src/client/component/splash.cpp +++ b/src/client/component/splash.cpp @@ -60,13 +60,15 @@ namespace splash this->destroy(); } - void hide() const + void hide() { if (this->window_ && IsWindow(this->window_)) { ShowWindow(this->window_, SW_HIDE); UpdateWindow(this->window_); } + + this->destroy(); } private: @@ -82,6 +84,7 @@ namespace splash ShowWindow(this->window_, SW_HIDE); DestroyWindow(this->window_); this->window_ = nullptr; + if (this->window_thread_.joinable()) { this->window_thread_.join(); @@ -89,6 +92,10 @@ namespace splash this->window_ = nullptr; } + else if (this->window_thread_.joinable()) + { + this->window_thread_.detach(); + } } void draw()