Implement QueryResult_AutoPtr type which is ACE's reference counted auto_ptr(ACE_Refcounted_Auto_Ptr) for QueryResult pointers.

Use this auto_ptr for every DB queries(except QueryNamedResult yet).

This patch guarantees NO memory leaks from QueryResult pointers.

Thanks to raczman for the idea and for the helping to make this patch.

--HG--
branch : trunk
This commit is contained in:
Anubisss
2010-01-23 14:45:58 +01:00
parent c784110d87
commit d9cb070215
76 changed files with 458 additions and 1108 deletions
+1 -4
View File
@@ -33,7 +33,7 @@
void MapManager::LoadTransports()
{
QueryResult *result = WorldDatabase.Query("SELECT entry, name, period FROM transports");
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, name, period FROM transports");
uint32 count = 0;
@@ -111,7 +111,6 @@ void MapManager::LoadTransports()
//t->GetMap()->Add<GameObject>((GameObject *)t);
++count;
} while(result->NextRow());
delete result;
sLog.outString();
sLog.outString( ">> Loaded %u transports", count );
@@ -130,8 +129,6 @@ void MapManager::LoadTransports()
sLog.outErrorDb("Transport %u '%s' have record (GUID: %u) in `gameobject`. Transports DON'T must have any records in `gameobject` or its behavior will be unpredictable/bugged.",entry,name.c_str(),guid);
}
while(result->NextRow());
delete result;
}
}