diff options
author | Anubisss <none@none> | 2010-01-23 14:45:58 +0100 |
---|---|---|
committer | Anubisss <none@none> | 2010-01-23 14:45:58 +0100 |
commit | d9cb0702158fd045285f2c0a904cb31a45a3864a (patch) | |
tree | cdc6a7c6a83c6eea603ae296a653fb9f04945aad /src/game/Group.cpp | |
parent | c784110d87666579f18620a98e1e57118db4a9cf (diff) |
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
Diffstat (limited to 'src/game/Group.cpp')
-rw-r--r-- | src/game/Group.cpp | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/game/Group.cpp b/src/game/Group.cpp index c0bfc7ef182..a4ebf7bfc27 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -125,7 +125,7 @@ bool Group::Create(const uint64 &guid, const char * name) return true; } -bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult *result, bool loadMembers) +bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult_AutoPtr result, bool loadMembers) { if(isBGGroup()) return false; @@ -144,10 +144,7 @@ bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult *result, bool // group leader not exist if(!objmgr.GetPlayerNameByGUID(m_leaderGuid, m_leaderName)) - { - if(!external) delete result; return false; - } m_groupType = (*result)[13].GetBool() ? GROUPTYPE_RAID : GROUPTYPE_NORMAL; @@ -172,7 +169,6 @@ bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult *result, bool for (int i=0; i<TARGETICONCOUNT; ++i) m_targetIcons[i] = (*result)[5+i].GetUInt64(); - if(!external) delete result; if(loadMembers) { @@ -184,7 +180,6 @@ bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult *result, bool { LoadMemberFromDB((*result)[0].GetUInt32(), (*result)[2].GetUInt8(), (*result)[1].GetBool()); } while( result->NextRow() ); - delete result; // group too small if(GetMembersCount() < 2) return false; |