Fix market reload and a crash when exiting

This commit is contained in:
Eduardo Bart 2012-07-31 11:42:26 -03:00
parent bca1af8f11
commit 614d1544c0
13 changed files with 15 additions and 23 deletions

View File

@ -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

View File

@ -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()

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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)

View File

@ -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();

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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

View File

@ -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
}

View File

@ -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();