mirror of
https://github.com/SFML/SFML.git
synced 2024-11-24 20:31:05 +08:00
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:
parent
dff83039aa
commit
58085efb29
@ -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)
|
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
|
// Recreate the window implementation
|
||||||
m_impl = priv::WindowImpl::create(mode, title, style, state, settings);
|
m_impl = priv::WindowImpl::create(mode, title, style, state, settings);
|
||||||
|
|
||||||
|
@ -112,6 +112,9 @@ void WindowBase::create(VideoMode mode, const String& title, State state)
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void WindowBase::create(WindowHandle handle)
|
void WindowBase::create(WindowHandle handle)
|
||||||
{
|
{
|
||||||
|
// Ensure the open window is closed first
|
||||||
|
close();
|
||||||
|
|
||||||
// Recreate the window implementation
|
// Recreate the window implementation
|
||||||
m_impl = priv::WindowImpl::create(handle);
|
m_impl = priv::WindowImpl::create(handle);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user