diff --git a/src/SFML/Window/Window.cpp b/src/SFML/Window/Window.cpp index 54d6ac3bd..d042d0f48 100644 --- a/src/SFML/Window/Window.cpp +++ b/src/SFML/Window/Window.cpp @@ -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); diff --git a/src/SFML/Window/WindowBase.cpp b/src/SFML/Window/WindowBase.cpp index f16d9513a..20648561d 100644 --- a/src/SFML/Window/WindowBase.cpp +++ b/src/SFML/Window/WindowBase.cpp @@ -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);