Close the open window first

This prevents race conditions where for a brief moment two different
window implementations can exist and cause uniqueness issues
This commit is contained in:
Lukas Dürrenberger 2024-11-09 12:27:45 +01:00
parent dff83039aa
commit 58085efb29
2 changed files with 6 additions and 0 deletions

View File

@ -84,6 +84,9 @@ void Window::create(VideoMode mode, const String& title, std::uint32_t style, St
////////////////////////////////////////////////////////////
void Window::create(VideoMode mode, const String& title, std::uint32_t style, State state, const ContextSettings& settings)
{
// Ensure the open window is closed first
close();
// Recreate the window implementation
m_impl = priv::WindowImpl::create(mode, title, style, state, settings);

View File

@ -112,6 +112,9 @@ void WindowBase::create(VideoMode mode, const String& title, State state)
////////////////////////////////////////////////////////////
void WindowBase::create(WindowHandle handle)
{
// Ensure the open window is closed first
close();
// Recreate the window implementation
m_impl = priv::WindowImpl::create(handle);