Better window destruction

This commit is contained in:
momo5502 2022-06-16 14:33:49 +02:00
parent ea3c66239e
commit 95df3ba287

View File

@ -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()