Implement message modes for 9.6

Fix possible crash when closing otclient
Fix private messages
Fix messages in 9.6
This commit is contained in:
Eduardo Bart
2012-07-30 09:29:13 -03:00
parent 1281b04a6a
commit 59b6abfa09
22 changed files with 95 additions and 42 deletions

View File

@@ -97,6 +97,9 @@ void Application::deinit()
// poll remaining events
poll();
// disable dispatcher events
g_dispatcher.shutdown();
}
void Application::terminate()
@@ -115,9 +118,6 @@ void Application::terminate()
// terminate script environment
g_lua.terminate();
// flush remaining dispatcher events
g_dispatcher.flush();
m_terminated = true;
}

View File

@@ -27,7 +27,7 @@
EventDispatcher g_dispatcher;
void EventDispatcher::flush()
void EventDispatcher::shutdown()
{
while(!m_eventList.empty())
poll();

View File

@@ -30,7 +30,7 @@
class EventDispatcher
{
public:
void flush();
void shutdown();
void poll();
EventPtr addEvent(const std::function<void()>& callback, bool pushFront = false);

View File

@@ -37,7 +37,11 @@ FileStream::FileStream(const std::string& name, PHYSFS_File *fileHandle, bool wr
FileStream::~FileStream()
{
assert(!g_app.isTerminated());
#ifndef NDEBUG
if(g_app.isTerminated())
g_logger.warning("FileStream reference not released");
#endif
if(!g_app.isTerminated())
close();
}
@@ -63,7 +67,7 @@ void FileStream::cache()
void FileStream::close()
{
if(m_fileHandle) {
if(m_fileHandle && PHYSFS_isInit()) {
if(!PHYSFS_close(m_fileHandle))
throwError("close failed", true);
m_fileHandle = nullptr;