summaryrefslogtreecommitdiff
path: root/modules/extra/m_mysql.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-08-17 22:19:36 -0400
committerAdam <Adam@anope.org>2010-08-17 22:19:36 -0400
commitb180d5f975b3fd9a096a712adf9589c360831f72 (patch)
tree34952f6bb9d25653f43c90a9ca603214af4ca52c /modules/extra/m_mysql.cpp
parentfa7684b3a3eea24ab72549aded6466eb0bede5fb (diff)
Always unload socketengines/database/protocl etc modules last, and fixed a potential crash in m_mysql when unloading when not in GDB
Diffstat (limited to 'modules/extra/m_mysql.cpp')
-rw-r--r--modules/extra/m_mysql.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/extra/m_mysql.cpp b/modules/extra/m_mysql.cpp
index 72176fa70..176899a1b 100644
--- a/modules/extra/m_mysql.cpp
+++ b/modules/extra/m_mysql.cpp
@@ -187,8 +187,7 @@ class ModuleSQL : public Module
DThread->Wakeup();
DThread->Join();
- if (SocketEngine)
- delete SQLPipe;
+ delete SQLPipe;
}
void OnReload(bool startup)
@@ -278,9 +277,10 @@ MySQLService::MySQLService(Module *o, const Anope::string &n, const Anope::strin
MySQLService::~MySQLService()
{
+ me->DThread->Lock();
this->Lock.Lock();
- this->Lock.Unlock();
mysql_close(this->sql);
+ this->sql = NULL;
for (unsigned i = me->QueryRequests.size(); i > 0; --i)
{
@@ -293,6 +293,8 @@ MySQLService::~MySQLService()
me->QueryRequests.erase(me->QueryRequests.begin() + i);
}
}
+ this->Lock.Unlock();
+ me->DThread->Unlock();
}
void MySQLService::Run(SQLInterface *i, const Anope::string &query)