SDK: Fix console layer having trouble with late constructed windows
Former-commit-id: e5882089bc09649b545da8ea8a222b89417851a0 [formerly 1a114b80d1a97b96e764a2732ce8200244389283] [formerly f36d163b9d5a52c2958468dd26d9086b86c6710b [formerly 71b9edd9938eb30860da96234605a001173eaa23]] Former-commit-id: 8fd9120c8333c10f95d66d859eef2c64c58efc28 [formerly 423c0088ec020881cbf207470787d86929f34fd4] Former-commit-id: e283df698adfb17f2d40156ad411e9a6acac1f7a
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Utility/Window.hpp>
|
||||
#include <Nazara/Core/CallOnExit.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/ErrorFlags.hpp>
|
||||
#include <Nazara/Core/LockGuard.hpp>
|
||||
@@ -60,25 +61,22 @@ namespace Nz
|
||||
else if (style & WindowStyle_Closable || style & WindowStyle_Resizable)
|
||||
style |= WindowStyle_Titlebar;
|
||||
|
||||
m_impl = new WindowImpl(this);
|
||||
if (!m_impl->Create(mode, title, style))
|
||||
std::unique_ptr<WindowImpl> impl = std::make_unique<WindowImpl>(this);
|
||||
if (!impl->Create(mode, title, style))
|
||||
{
|
||||
NazaraError("Failed to create window implementation");
|
||||
delete m_impl;
|
||||
m_impl = nullptr;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
m_impl = impl.release();
|
||||
CallOnExit destroyOnFailure([this] () { Destroy(); });
|
||||
|
||||
m_closed = false;
|
||||
m_ownsWindow = true;
|
||||
|
||||
if (!OnWindowCreated())
|
||||
{
|
||||
NazaraError("Failed to initialize window extension");
|
||||
delete m_impl;
|
||||
m_impl = nullptr;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -93,6 +91,10 @@ namespace Nz
|
||||
if (opened)
|
||||
m_impl->SetPosition(position.x, position.y);
|
||||
|
||||
OnWindowResized();
|
||||
|
||||
destroyOnFailure.Reset();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user