diff --git a/modules/game_market/marketprotocol.lua b/modules/game_market/marketprotocol.lua index a9cf413c..43044475 100644 --- a/modules/game_market/marketprotocol.lua +++ b/modules/game_market/marketprotocol.lua @@ -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 diff --git a/src/framework/core/filestream.cpp b/src/framework/core/filestream.cpp index 2864f1cf..04e21207 100644 --- a/src/framework/core/filestream.cpp +++ b/src/framework/core/filestream.cpp @@ -38,11 +38,10 @@ 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(); + close(); } void FileStream::cache() diff --git a/src/framework/graphics/framebuffer.cpp b/src/framework/graphics/framebuffer.cpp index c21fa994..0b02efd2 100644 --- a/src/framework/graphics/framebuffer.cpp +++ b/src/framework/graphics/framebuffer.cpp @@ -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); diff --git a/src/framework/graphics/hardwarebuffer.cpp b/src/framework/graphics/hardwarebuffer.cpp index 8e63cf58..bd206afe 100644 --- a/src/framework/graphics/hardwarebuffer.cpp +++ b/src/framework/graphics/hardwarebuffer.cpp @@ -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); diff --git a/src/framework/graphics/shader.cpp b/src/framework/graphics/shader.cpp index a47c121d..7be3d438 100644 --- a/src/framework/graphics/shader.cpp +++ b/src/framework/graphics/shader.cpp @@ -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); diff --git a/src/framework/graphics/shaderprogram.cpp b/src/framework/graphics/shaderprogram.cpp index 1d232b54..cc9f9252 100644 --- a/src/framework/graphics/shaderprogram.cpp +++ b/src/framework/graphics/shaderprogram.cpp @@ -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); diff --git a/src/framework/graphics/texture.cpp b/src/framework/graphics/texture.cpp index 02969d2f..3bfc5084 100644 --- a/src/framework/graphics/texture.cpp +++ b/src/framework/graphics/texture.cpp @@ -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) diff --git a/src/framework/luaengine/luaobject.cpp b/src/framework/luaengine/luaobject.cpp index d5672a74..68de550d 100644 --- a/src/framework/luaengine/luaobject.cpp +++ b/src/framework/luaengine/luaobject.cpp @@ -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(); diff --git a/src/framework/net/connection.cpp b/src/framework/net/connection.cpp index 804b81f7..d02397b1 100644 --- a/src/framework/net/connection.cpp +++ b/src/framework/net/connection.cpp @@ -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(); } diff --git a/src/framework/net/protocol.cpp b/src/framework/net/protocol.cpp index 90169087..5ff8773f 100644 --- a/src/framework/net/protocol.cpp +++ b/src/framework/net/protocol.cpp @@ -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(); } diff --git a/src/framework/ui/uiwidget.cpp b/src/framework/ui/uiwidget.cpp index 152f4b8d..7ae8d151 100644 --- a/src/framework/ui/uiwidget.cpp +++ b/src/framework/ui/uiwidget.cpp @@ -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 diff --git a/src/otclient/mapview.cpp b/src/otclient/mapview.cpp index f7853848..da1017c7 100644 --- a/src/otclient/mapview.cpp +++ b/src/otclient/mapview.cpp @@ -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 } diff --git a/src/otclient/otclient.cpp b/src/otclient/otclient.cpp index b5dced86..060b2580 100644 --- a/src/otclient/otclient.cpp +++ b/src/otclient/otclient.cpp @@ -79,6 +79,7 @@ void OTClient::init(const std::vector& args) void OTClient::terminate() { + g_game.terminate(); g_map.terminate(); g_things.terminate(); g_sprites.terminate();