Made Context::Create exception-safe
Former-commit-id: 913e87b684028ca6f9c41e529628c77c171761c1
This commit is contained in:
parent
fe8ff688e8
commit
3035fb8fa2
|
|
@ -3,6 +3,7 @@
|
|||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Renderer/Context.hpp>
|
||||
#include <Nazara/Core/CallOnExit.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Core/Log.hpp>
|
||||
#include <Nazara/Core/StringStream.hpp>
|
||||
|
|
@ -149,14 +150,13 @@ bool NzContext::Create(const NzContextParameters& parameters)
|
|||
return false;
|
||||
}
|
||||
|
||||
m_impl = impl.release();
|
||||
|
||||
NzCallOnExit onExit([this] () { Destroy(); });
|
||||
|
||||
if (!SetActive(true))
|
||||
{
|
||||
NazaraError("Failed to activate context");
|
||||
|
||||
m_impl->Destroy();
|
||||
delete m_impl;
|
||||
m_impl = nullptr;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -172,6 +172,8 @@ bool NzContext::Create(const NzContextParameters& parameters)
|
|||
#endif
|
||||
}
|
||||
|
||||
onExit.Reset();
|
||||
|
||||
NotifyCreated();
|
||||
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue