mirror of
https://github.com/edubart/otclient.git
synced 2025-10-17 13:03:27 +02:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -27,7 +27,7 @@
|
||||
|
||||
EventDispatcher g_dispatcher;
|
||||
|
||||
void EventDispatcher::flush()
|
||||
void EventDispatcher::shutdown()
|
||||
{
|
||||
while(!m_eventList.empty())
|
||||
poll();
|
||||
|
@@ -30,7 +30,7 @@
|
||||
class EventDispatcher
|
||||
{
|
||||
public:
|
||||
void flush();
|
||||
void shutdown();
|
||||
void poll();
|
||||
|
||||
EventPtr addEvent(const std::function<void()>& callback, bool pushFront = false);
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user