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