Fix market reload and a crash when exiting
This commit is contained in:
parent
bca1af8f11
commit
614d1544c0
|
@ -128,6 +128,7 @@ function initProtocol()
|
|||
|
||||
-- reloading module
|
||||
if g_game.isOnline() then
|
||||
MarketProtocol.registerProtocol()
|
||||
MarketProtocol.updateProtocol(g_game.getProtocolGame())
|
||||
end
|
||||
end
|
||||
|
@ -139,6 +140,7 @@ function terminateProtocol()
|
|||
-- reloading module
|
||||
if not g_game.isOnline() then
|
||||
MarketProtocol.updateProtocol(nil)
|
||||
MarketProtocol.unregisterProtocol()
|
||||
end
|
||||
MarketProtocol = nil
|
||||
end
|
||||
|
|
|
@ -38,8 +38,7 @@ FileStream::FileStream(const std::string& name, PHYSFS_File *fileHandle, bool wr
|
|||
FileStream::~FileStream()
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
if(g_app.isTerminated())
|
||||
g_logger.warning("FileStream reference not released");
|
||||
assert(!g_app.isTerminated());
|
||||
#endif
|
||||
if(!g_app.isTerminated())
|
||||
close();
|
||||
|
|
|
@ -48,8 +48,7 @@ void FrameBuffer::internalCreate()
|
|||
FrameBuffer::~FrameBuffer()
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
if(g_app.isTerminated())
|
||||
g_logger.warning("FrameBuffer reference not released");
|
||||
assert(!g_app.isTerminated());
|
||||
#endif
|
||||
if(g_graphics.ok() && m_fbo != 0)
|
||||
glDeleteFramebuffers(1, &m_fbo);
|
||||
|
|
|
@ -38,8 +38,7 @@ HardwareBuffer::HardwareBuffer(Type type)
|
|||
HardwareBuffer::~HardwareBuffer()
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
if(g_app.isTerminated())
|
||||
g_logger.warning("HardwareBuffer reference not released");
|
||||
assert(!g_app.isTerminated());
|
||||
#endif
|
||||
if(g_graphics.ok())
|
||||
glDeleteBuffers(1, &m_id);
|
||||
|
|
|
@ -45,8 +45,7 @@ Shader::Shader(Shader::ShaderType shaderType)
|
|||
Shader::~Shader()
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
if(g_app.isTerminated())
|
||||
g_logger.warning("Shader reference not released");
|
||||
assert(!g_app.isTerminated());
|
||||
#endif
|
||||
if(g_graphics.ok())
|
||||
glDeleteShader(m_shaderId);
|
||||
|
|
|
@ -39,8 +39,7 @@ ShaderProgram::ShaderProgram()
|
|||
ShaderProgram::~ShaderProgram()
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
if(g_app.isTerminated())
|
||||
g_logger.warning("ShaderProgram reference not released");
|
||||
assert(!g_app.isTerminated());
|
||||
#endif
|
||||
if(g_graphics.ok())
|
||||
glDeleteProgram(m_programId);
|
||||
|
|
|
@ -80,8 +80,7 @@ Texture::Texture(const ImagePtr& image, bool buildMipmaps)
|
|||
Texture::~Texture()
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
if(g_app.isTerminated())
|
||||
g_logger.warning("a texture reference was not released");
|
||||
assert(!g_app.isTerminated());
|
||||
#endif
|
||||
// free texture from gl memory
|
||||
if(g_graphics.ok() && m_id != 0)
|
||||
|
|
|
@ -34,8 +34,7 @@ LuaObject::LuaObject() :
|
|||
LuaObject::~LuaObject()
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
if(g_app.isTerminated())
|
||||
g_logger.warning("LuaObject reference not released");
|
||||
assert(!g_app.isTerminated());
|
||||
#endif
|
||||
releaseLuaFieldsTable();
|
||||
|
||||
|
|
|
@ -42,8 +42,7 @@ Connection::Connection() :
|
|||
Connection::~Connection()
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
if(g_app.isTerminated())
|
||||
g_logger.warning("Connection reference not released");
|
||||
assert(!g_app.isTerminated());
|
||||
#endif
|
||||
close();
|
||||
}
|
||||
|
|
|
@ -34,8 +34,7 @@ Protocol::Protocol()
|
|||
Protocol::~Protocol()
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
if(g_app.isTerminated())
|
||||
g_logger.warning("Protocol reference not released");
|
||||
assert(!g_app.isTerminated());
|
||||
#endif
|
||||
disconnect();
|
||||
}
|
||||
|
|
|
@ -47,8 +47,7 @@ UIWidget::UIWidget()
|
|||
UIWidget::~UIWidget()
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
if(g_app.isTerminated())
|
||||
g_logger.warning(stdext::format("UIWidget '%s' reference not released", m_id));
|
||||
assert(!g_app.isTerminated());
|
||||
if(!m_destroyed)
|
||||
g_logger.warning(stdext::format("widget '%s' was not explicitly destroyed", m_id));
|
||||
#endif
|
||||
|
|
|
@ -65,8 +65,7 @@ MapView::MapView()
|
|||
MapView::~MapView()
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
if(g_app.isTerminated())
|
||||
g_logger.warning("MapView reference not released");
|
||||
assert(!g_app.isTerminated());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ void OTClient::init(const std::vector<std::string>& args)
|
|||
|
||||
void OTClient::terminate()
|
||||
{
|
||||
g_game.terminate();
|
||||
g_map.terminate();
|
||||
g_things.terminate();
|
||||
g_sprites.terminate();
|
||||
|
|
Loading…
Reference in New Issue