Fix crash introduced in 4610bbf047.

- Update SqlAsyncTask´s destructor, properly NULLpoint SqlOperation* m_op so other threads can deal with it accordingly.
- Don´t keep NULL´d elements in transaction queues, remove them instead.

This now means you should be able to run a stable server with > 2 MapUpdate threads. Please leave feedback.

Courtesy of click and myself.

--HG--
branch : trunk
This commit is contained in:
Machiavelli
2010-05-13 17:24:54 +02:00
parent 28bbc233d1
commit 144a146810
2 changed files with 14 additions and 5 deletions
+2
View File
@@ -591,6 +591,7 @@ bool Database::CommitTransaction()
if (i != m_tranQueues.end() && i->second != NULL)
{
m_threadBody->Delay(i->second);
m_tranQueues.erase(i);
return true;
}
else
@@ -620,6 +621,7 @@ bool Database::RollbackTransaction()
{
delete i->second;
i->second = NULL;
m_tranQueues.erase(i);
}
return true;
+12 -5
View File
@@ -125,21 +125,28 @@ class SqlQueryHolderEx : public SqlOperation
class SqlAsyncTask : public ACE_Method_Request
{
public:
SqlAsyncTask(Database * db, SqlOperation * op) : m_db(db), m_op(op) {}
~SqlAsyncTask() { if(!m_op) return; delete m_op; }
SqlAsyncTask(Database * db, SqlOperation * op) : m_db(db), m_op(op){}
~SqlAsyncTask()
{
if (!m_op)
return;
delete m_op;
m_op = NULL;
}
int call()
{
if(m_db == NULL || m_op == NULL)
if (m_db == NULL || m_op == NULL)
return -1;
try
{
m_op->Execute(m_db);
m_op->Execute(m_db);
}
catch(...)
{
return -1;
return -1;
}
return 0;