SDK: Fix console layer having trouble with late constructed windows
Former-commit-id: 133d95cfd48f629cc9902c06861f3e6a73723a53 [formerly 7dde3eef66fc5274daf95b76b61d2b81fc6c9d16] [formerly e8e97d8cbaf703353b263a15cf51ed590f926818 [formerly f01a48da96b3fb545bb4d42d35e443c79f1bdfa0]] Former-commit-id: 67a9b3b9591490f94185b8ec917b5e1aab1a8e4e [formerly 90badb351e6406eb175dab65d9bb76f4f13bfd63] Former-commit-id: 37de44e5597c8cea7fcbd7455136eef8cb4cfee0
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