Browse Source

Merge pnUtRef with hsRefCnt, and remove the former

Michael Hansen 10 years ago
parent
commit
d713a13dbe
  1. 31
      Sources/Plasma/CoreLib/hsRefCnt.cpp
  2. 13
      Sources/Plasma/CoreLib/hsRefCnt.h
  3. 4
      Sources/Plasma/FeatureLib/pfPython/cyAvatar.cpp
  4. 4
      Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp
  5. 2
      Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp
  6. 32
      Sources/Plasma/FeatureLib/pfPython/pyAgeVault.cpp
  7. 6
      Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.cpp
  8. 8
      Sources/Plasma/FeatureLib/pfPython/pyGameScore.cpp
  9. 70
      Sources/Plasma/FeatureLib/pfPython/pyVault.cpp
  10. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoListNodeGlue.cpp
  11. 8
      Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp
  12. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNodeGlue.cpp
  13. 2
      Sources/Plasma/FeatureLib/pfPython/pyVaultAgeLinkNode.cpp
  14. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultAgeLinkNodeGlue.cpp
  15. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultChronicleNodeGlue.cpp
  16. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNodeGlue.cpp
  17. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultImageNodeGlue.cpp
  18. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNodeGlue.cpp
  19. 42
      Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp
  20. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultNodeGlue.cpp
  21. 18
      Sources/Plasma/FeatureLib/pfPython/pyVaultNodeRef.cpp
  22. 8
      Sources/Plasma/FeatureLib/pfPython/pyVaultNodeRefGlue.cpp
  23. 24
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoListNode.cpp
  24. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoListNodeGlue.cpp
  25. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNodeGlue.cpp
  26. 10
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.cpp
  27. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNodeGlue.cpp
  28. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultSDLNodeGlue.cpp
  29. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultSystemNodeGlue.cpp
  30. 2
      Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNode.cpp
  31. 4
      Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNodeGlue.cpp
  32. 15
      Sources/Plasma/NucleusLib/pnNetCli/pnNcChannel.cpp
  33. 3
      Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.h
  34. 1
      Sources/Plasma/NucleusLib/pnUtils/CMakeLists.txt
  35. 1
      Sources/Plasma/NucleusLib/pnUtils/pnUtAllIncludes.h
  36. 180
      Sources/Plasma/NucleusLib/pnUtils/pnUtRef.h
  37. 40
      Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp
  38. 2
      Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp
  39. 20
      Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp
  40. 6
      Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp
  41. 2
      Sources/Plasma/PubUtilLib/plNetGameLib/Intern.h
  42. 54
      Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp
  43. 26
      Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.cpp
  44. 28
      Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.cpp
  45. 26
      Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp
  46. 10
      Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglTrans.cpp
  47. 2
      Sources/Plasma/PubUtilLib/plNetMessage/plNetCommonMessage.h
  48. 420
      Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp
  49. 4
      Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp

31
Sources/Plasma/CoreLib/hsRefCnt.cpp

@ -65,21 +65,48 @@ void hsRefCnt::UnRef()
--fRefCnt; --fRefCnt;
} }
hsSafeRefCnt::~hsSafeRefCnt() hsAtomicRefCnt::~hsAtomicRefCnt()
{ {
#ifdef HS_DEBUGGING #ifdef HS_DEBUGGING
hsThrowIfFalse(fRefCnt == 1); hsThrowIfFalse(fRefCnt == 1);
#endif #endif
} }
void hsSafeRefCnt::UnRef() void hsAtomicRefCnt::UnRef(const char* tag)
{ {
#ifdef HS_DEBUGGING #ifdef HS_DEBUGGING
hsThrowIfFalse(fRefCnt >= 1); hsThrowIfFalse(fRefCnt >= 1);
#endif #endif
#ifdef REFCOUNT_DEBUGGING
if (tag)
DEBUG_MSG("Dec %p %s: %u", this, tag, prev - 1);
else
DEBUG_MSG("Dec %p: %u", this, prev - 1);
#endif
if (fRefCnt == 1) // don't decrement if we call delete if (fRefCnt == 1) // don't decrement if we call delete
delete this; delete this;
else else
--fRefCnt; --fRefCnt;
} }
void hsAtomicRefCnt::Ref(const char* tag)
{
#ifdef REFCOUNT_DEBUGGING
if (tag)
DEBUG_MSG("Inc %p %s: %u", this, tag, prev + 1);
else
DEBUG_MSG("Inc %p: %u", this, prev + 1);
#endif
++fRefCnt;
}
void hsAtomicRefCnt::TransferRef(const char* oldTag, const char* newTag)
{
#ifdef REFCOUNT_DEBUGGING
DEBUG_MSG("Inc %p %s: (xfer)", this, newTag);
DEBUG_MSG("Dec %p %s: (xfer)", this, oldTag);
#endif
}

13
Sources/Plasma/CoreLib/hsRefCnt.h

@ -69,18 +69,21 @@ public:
// Thread-safe version. TODO: Evaluate whether this is fast enough to // Thread-safe version. TODO: Evaluate whether this is fast enough to
// merge with hsRefCnt above. // merge with hsRefCnt above.
class hsSafeRefCnt class hsAtomicRefCnt
{ {
private: private:
std::atomic<int> fRefCnt; std::atomic<int> fRefCnt;
public: public:
hsSafeRefCnt() : fRefCnt(1) { } hsAtomicRefCnt() : fRefCnt(1) { }
virtual ~hsSafeRefCnt(); virtual ~hsAtomicRefCnt();
inline int RefCnt() const { return fRefCnt; } inline int RefCnt() const { return fRefCnt; }
void UnRef(); void UnRef(const char* tag = nullptr);
inline void Ref() { ++fRefCnt; } void Ref(const char* tag = nullptr);
// Useless, but left here for debugging compatibility with AtomicRef
void TransferRef(const char* oldTag, const char* newTag);
}; };
#endif #endif

4
Sources/Plasma/FeatureLib/pfPython/cyAvatar.cpp

@ -1695,7 +1695,7 @@ void cyAvatar::ChangeAvatar(const char* genderName)
if (rvnPlr) { if (rvnPlr) {
VaultPlayerNode plr(rvnPlr); VaultPlayerNode plr(rvnPlr);
plr.SetAvatarShapeName(wStr); plr.SetAvatarShapeName(wStr);
rvnPlr->DecRef(); rvnPlr->UnRef();
} }
#endif #endif
} }
@ -1716,7 +1716,7 @@ void cyAvatar::ChangePlayerName(const char* playerName)
if (rvnPlr) { if (rvnPlr) {
VaultPlayerNode plr(rvnPlr); VaultPlayerNode plr(rvnPlr);
plr.SetPlayerName(wStr); plr.SetPlayerName(wStr);
rvnPlr->DecRef(); rvnPlr->UnRef();
} }
} }

4
Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp

@ -2474,7 +2474,7 @@ int cyMisc::GetKILevel()
if (RelVaultNode * rvn = VaultFindChronicleEntryIncRef(wStr)) { if (RelVaultNode * rvn = VaultFindChronicleEntryIncRef(wStr)) {
VaultChronicleNode chron(rvn); VaultChronicleNode chron(rvn);
result = wcstol(chron.GetEntryValue(), nil, 0); result = wcstol(chron.GetEntryValue(), nil, 0);
rvn->DecRef(); rvn->UnRef();
} }
return result; return result;
@ -2893,7 +2893,7 @@ void cyMisc::SendFriendInvite(const wchar_t email[], const wchar_t toName[])
} }
NetCommSendFriendInvite(email, toName, inviteUuid); NetCommSendFriendInvite(email, toName, inviteUuid);
pNode->DecRef(); pNode->UnRef();
} }
} }

2
Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp

@ -2082,7 +2082,7 @@ bool plPythonFileMod::MsgReceive(plMessage* msg)
Py_DECREF(ptuple); Py_DECREF(ptuple);
ptuple = PyTuple_New(1); ptuple = PyTuple_New(1);
PyTuple_SetItem(ptuple, 0, pyVaultAgeLinkNode::New(rvn)); PyTuple_SetItem(ptuple, 0, pyVaultAgeLinkNode::New(rvn));
rvn->DecRef(); rvn->UnRef();
} }
} }
break; break;

32
Sources/Plasma/FeatureLib/pfPython/pyAgeVault.cpp

@ -84,7 +84,7 @@ PyObject* pyAgeVault::GetAgeInfo()
RelVaultNode * rvn = VaultGetAgeInfoNodeIncRef(); RelVaultNode * rvn = VaultGetAgeInfoNodeIncRef();
if (rvn) { if (rvn) {
PyObject * result = pyVaultAgeInfoNode::New(rvn); PyObject * result = pyVaultAgeInfoNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
return result; return result;
} }
@ -97,7 +97,7 @@ PyObject* pyAgeVault::GetAgeDevicesFolder( void )
RelVaultNode * rvn = VaultGetAgeDevicesFolderIncRef(); RelVaultNode * rvn = VaultGetAgeDevicesFolderIncRef();
if (rvn) { if (rvn) {
PyObject * result = pyVaultFolderNode::New(rvn); PyObject * result = pyVaultFolderNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
return result; return result;
} }
@ -110,7 +110,7 @@ PyObject* pyAgeVault::GetSubAgesFolder( void )
RelVaultNode * rvn = VaultGetAgeSubAgesFolderIncRef(); RelVaultNode * rvn = VaultGetAgeSubAgesFolderIncRef();
if (rvn) { if (rvn) {
PyObject * result = pyVaultFolderNode::New(rvn); PyObject * result = pyVaultFolderNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
return result; return result;
} }
@ -123,7 +123,7 @@ PyObject* pyAgeVault::GetChronicleFolder( void )
RelVaultNode * rvn = VaultGetAgeChronicleFolderIncRef(); RelVaultNode * rvn = VaultGetAgeChronicleFolderIncRef();
if (rvn) { if (rvn) {
PyObject * result = pyVaultFolderNode::New(rvn); PyObject * result = pyVaultFolderNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
return result; return result;
} }
@ -136,7 +136,7 @@ PyObject* pyAgeVault::GetBookshelfFolder ( void )
RelVaultNode * rvn = VaultAgeGetBookshelfFolderIncRef(); RelVaultNode * rvn = VaultAgeGetBookshelfFolderIncRef();
if (rvn) { if (rvn) {
PyObject * result = pyVaultFolderNode::New(rvn); PyObject * result = pyVaultFolderNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
return result; return result;
} }
@ -149,7 +149,7 @@ PyObject* pyAgeVault::GetPeopleIKnowAboutFolder( void )
RelVaultNode * rvn = VaultGetAgePeopleIKnowAboutFolderIncRef(); RelVaultNode * rvn = VaultGetAgePeopleIKnowAboutFolderIncRef();
if (rvn) { if (rvn) {
PyObject * result = pyVaultFolderNode::New(rvn); PyObject * result = pyVaultFolderNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
return result; return result;
} }
@ -163,7 +163,7 @@ PyObject* pyAgeVault::GetPublicAgesFolder(void)
RelVaultNode * rvn = VaultGetAgePublicAgesFolderIncRef(); RelVaultNode * rvn = VaultGetAgePublicAgesFolderIncRef();
if (rvn) { if (rvn) {
PyObject * result = pyVaultFolderNode::New(rvn); PyObject * result = pyVaultFolderNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
return result; return result;
} }
@ -176,7 +176,7 @@ PyObject* pyAgeVault::GetSubAgeLink( const pyAgeInfoStruct & info )
RelVaultNode * rvn = VaultFindAgeSubAgeLinkIncRef(info.GetAgeInfo()); RelVaultNode * rvn = VaultFindAgeSubAgeLinkIncRef(info.GetAgeInfo());
if (rvn) { if (rvn) {
PyObject * result = pyVaultAgeLinkNode::New(rvn); PyObject * result = pyVaultAgeLinkNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
return result; return result;
} }
@ -190,7 +190,7 @@ plUUID pyAgeVault::GetAgeGuid( void )
if (rvn) { if (rvn) {
VaultAgeInfoNode ageInfo(rvn); VaultAgeInfoNode ageInfo(rvn);
plUUID uuid = ageInfo.GetAgeInstanceGuid(); plUUID uuid = ageInfo.GetAgeInstanceGuid();
rvn->DecRef(); rvn->UnRef();
return uuid; return uuid;
} }
return kNilUuid; return kNilUuid;
@ -206,7 +206,7 @@ PyObject* pyAgeVault::FindChronicleEntry( const char * entryName )
if (RelVaultNode * rvn = VaultFindAgeChronicleEntryIncRef(wEntryName)) { if (RelVaultNode * rvn = VaultFindAgeChronicleEntryIncRef(wEntryName)) {
PyObject * result = pyVaultChronicleNode::New(rvn); PyObject * result = pyVaultChronicleNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
return result; return result;
} }
@ -237,7 +237,7 @@ void pyAgeVault::AddDevice( const char * deviceName, PyObject * cbObject, uint32
if (RelVaultNode * rvn = VaultAgeAddDeviceAndWaitIncRef(wStr)) { if (RelVaultNode * rvn = VaultAgeAddDeviceAndWaitIncRef(wStr)) {
cb->SetNode(rvn); cb->SetNode(rvn);
rvn->DecRef(); rvn->UnRef();
} }
cb->VaultOperationComplete( cbContext, cb->GetNode() ? hsOK : hsFail); // cbHolder deletes itself here. cb->VaultOperationComplete( cbContext, cb->GetNode() ? hsOK : hsFail); // cbHolder deletes itself here.
@ -268,7 +268,7 @@ PyObject * pyAgeVault::GetDevice( const char * deviceName )
if (RelVaultNode * rvn = VaultAgeGetDeviceIncRef(wStr)) { if (RelVaultNode * rvn = VaultAgeGetDeviceIncRef(wStr)) {
PyObject * result = pyVaultTextNoteNode::New(rvn); PyObject * result = pyVaultTextNoteNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
return result; return result;
} }
@ -288,7 +288,7 @@ void pyAgeVault::SetDeviceInbox( const char * deviceName, const char * inboxName
if (RelVaultNode * rvn = VaultAgeSetDeviceInboxAndWaitIncRef(wDev, wInb)) { if (RelVaultNode * rvn = VaultAgeSetDeviceInboxAndWaitIncRef(wDev, wInb)) {
cb->SetNode(rvn); cb->SetNode(rvn);
rvn->DecRef(); rvn->UnRef();
} }
cb->VaultOperationComplete( cbContext, cb->GetNode() ? hsOK : hsFail ); // cbHolder deletes itself here. cb->VaultOperationComplete( cbContext, cb->GetNode() ? hsOK : hsFail ); // cbHolder deletes itself here.
@ -301,7 +301,7 @@ PyObject * pyAgeVault::GetDeviceInbox( const char * deviceName )
if (RelVaultNode * rvn = VaultAgeGetDeviceInboxIncRef(wStr)) { if (RelVaultNode * rvn = VaultAgeGetDeviceInboxIncRef(wStr)) {
PyObject * result = pyVaultTextNoteNode::New(rvn); PyObject * result = pyVaultTextNoteNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
return result; return result;
} }
@ -333,10 +333,10 @@ PyObject* pyAgeVault::FindNode( pyVaultNode* templateNode ) const
{ {
if (RelVaultNode * rvn = VaultGetAgeNodeIncRef()) { if (RelVaultNode * rvn = VaultGetAgeNodeIncRef()) {
RelVaultNode * find = rvn->GetChildNodeIncRef(templateNode->fNode, 1); RelVaultNode * find = rvn->GetChildNodeIncRef(templateNode->fNode, 1);
rvn->DecRef(); rvn->UnRef();
if (find) { if (find) {
PyObject * result = pyVaultNode::New(find); PyObject * result = pyVaultNode::New(find);
find->DecRef(); find->UnRef();
return result; return result;
} }
} }

6
Sources/Plasma/FeatureLib/pfPython/pyDniInfoSource.cpp

@ -81,7 +81,7 @@ uint32_t pyDniInfoSource::GetAgeTime( void ) const
result = (uint32_t)utime->GetSecs(); result = (uint32_t)utime->GetSecs();
else else
result = 0; result = 0;
node->DecRef(); node->UnRef();
return result; return result;
} }
@ -95,7 +95,7 @@ const char * pyDniInfoSource::GetAgeName( void ) const
VaultAgeInfoNode ageInfo(node); VaultAgeInfoNode ageInfo(node);
fAgeName = StrDupToAnsi(ageInfo.GetAgeInstanceName()); fAgeName = StrDupToAnsi(ageInfo.GetAgeInstanceName());
node->DecRef(); node->UnRef();
return fAgeName; return fAgeName;
} }
@ -106,7 +106,7 @@ plUUID pyDniInfoSource::GetAgeGuid( void ) const
{ {
VaultAgeInfoNode ageInfo(node); VaultAgeInfoNode ageInfo(node);
plUUID uuid = ageInfo.GetAgeInstanceGuid(); plUUID uuid = ageInfo.GetAgeInstanceGuid();
node->DecRef(); node->UnRef();
return uuid; return uuid;
} }

8
Sources/Plasma/FeatureLib/pfPython/pyGameScore.cpp

@ -129,7 +129,7 @@ void pyGameScore::CreateAgeScore(const plString& name, uint32_t type, int32_t po
{ {
uint32_t ownerId = ageInfo->GetNodeId(); uint32_t ownerId = ageInfo->GetNodeId();
pfGameScore::Create(ownerId, name, type, points, rcvr.getKey()); pfGameScore::Create(ownerId, name, type, points, rcvr.getKey());
ageInfo->DecRef(); ageInfo->UnRef();
} else } else
hsAssert(false, "Age has no vault... Need to rewrite score python script?"); hsAssert(false, "Age has no vault... Need to rewrite score python script?");
} }
@ -145,7 +145,7 @@ void pyGameScore::CreatePlayerScore(const plString& name, uint32_t type, int32_t
{ {
uint32_t ownerId = node->GetNodeId(); uint32_t ownerId = node->GetNodeId();
pfGameScore::Create(ownerId, name, type, points, rcvr.getKey()); pfGameScore::Create(ownerId, name, type, points, rcvr.getKey());
node->DecRef(); node->UnRef();
} else } else
hsAssert(false, "No PlayerInfo node... Need to rewrite python script?"); hsAssert(false, "No PlayerInfo node... Need to rewrite python script?");
} }
@ -161,7 +161,7 @@ void pyGameScore::FindAgeScores(const plString& name, pyKey& rcvr)
{ {
uint32_t ownerId = ageInfo->GetNodeId(); uint32_t ownerId = ageInfo->GetNodeId();
pfGameScore::Find(ownerId, name, rcvr.getKey()); pfGameScore::Find(ownerId, name, rcvr.getKey());
ageInfo->DecRef(); ageInfo->UnRef();
} else } else
hsAssert(false, "Age has no vault... Need to rewrite score python script?"); hsAssert(false, "Age has no vault... Need to rewrite score python script?");
} }
@ -177,7 +177,7 @@ void pyGameScore::FindPlayerScores(const plString& name, pyKey& rcvr)
{ {
uint32_t ownerId = node->GetNodeId(); uint32_t ownerId = node->GetNodeId();
pfGameScore::Find(ownerId, name, rcvr.getKey()); pfGameScore::Find(ownerId, name, rcvr.getKey());
node->DecRef(); node->UnRef();
} }
else else
hsAssert(false, "No PlayerInfo node.. Need to rewrite python script?"); hsAssert(false, "No PlayerInfo node.. Need to rewrite python script?");

70
Sources/Plasma/FeatureLib/pfPython/pyVault.cpp

@ -84,9 +84,9 @@ static PyObject * GetFolder (unsigned folderType) {
if (RelVaultNode * rvnPlr = VaultGetPlayerNodeIncRef()) { if (RelVaultNode * rvnPlr = VaultGetPlayerNodeIncRef()) {
if (RelVaultNode * rvnFldr = rvnPlr->GetChildFolderNodeIncRef(folderType, 1)) { if (RelVaultNode * rvnFldr = rvnPlr->GetChildFolderNodeIncRef(folderType, 1)) {
result = pyVaultFolderNode::New(rvnFldr); result = pyVaultFolderNode::New(rvnFldr);
rvnFldr->DecRef(); rvnFldr->UnRef();
} }
rvnPlr->DecRef(); rvnPlr->UnRef();
} }
return result; return result;
@ -98,9 +98,9 @@ static PyObject * GetPlayerInfoList (unsigned folderType) {
if (RelVaultNode * rvnPlr = VaultGetPlayerNodeIncRef()) { if (RelVaultNode * rvnPlr = VaultGetPlayerNodeIncRef()) {
if (RelVaultNode * rvnFldr = rvnPlr->GetChildPlayerInfoListNodeIncRef(folderType, 1)) { if (RelVaultNode * rvnFldr = rvnPlr->GetChildPlayerInfoListNodeIncRef(folderType, 1)) {
result = pyVaultPlayerInfoListNode::New(rvnFldr); result = pyVaultPlayerInfoListNode::New(rvnFldr);
rvnFldr->DecRef(); rvnFldr->UnRef();
} }
rvnPlr->DecRef(); rvnPlr->UnRef();
} }
return result; return result;
@ -112,9 +112,9 @@ static PyObject * GetAgeInfoList (unsigned folderType) {
if (RelVaultNode * rvnPlr = VaultGetPlayerNodeIncRef()) { if (RelVaultNode * rvnPlr = VaultGetPlayerNodeIncRef()) {
if (RelVaultNode * rvnFldr = rvnPlr->GetChildAgeInfoListNodeIncRef(folderType, 1)) { if (RelVaultNode * rvnFldr = rvnPlr->GetChildAgeInfoListNodeIncRef(folderType, 1)) {
result = pyVaultAgeInfoListNode::New(rvnFldr); result = pyVaultAgeInfoListNode::New(rvnFldr);
rvnFldr->DecRef(); rvnFldr->UnRef();
} }
rvnPlr->DecRef(); rvnPlr->UnRef();
} }
return result; return result;
@ -127,9 +127,9 @@ PyObject* pyVault::GetPlayerInfo()
if (RelVaultNode * rvnPlr = VaultGetPlayerNodeIncRef()) { if (RelVaultNode * rvnPlr = VaultGetPlayerNodeIncRef()) {
if (RelVaultNode * rvnPlrInfo = rvnPlr->GetChildNodeIncRef(plVault::kNodeType_PlayerInfo, 1)) { if (RelVaultNode * rvnPlrInfo = rvnPlr->GetChildNodeIncRef(plVault::kNodeType_PlayerInfo, 1)) {
result = pyVaultPlayerInfoNode::New(rvnPlrInfo); result = pyVaultPlayerInfoNode::New(rvnPlrInfo);
rvnPlrInfo->DecRef(); rvnPlrInfo->UnRef();
} }
rvnPlr->DecRef(); rvnPlr->UnRef();
} }
// just return an empty node // just return an empty node
@ -231,13 +231,13 @@ PyObject* pyVault::GetKIUsage(void)
++notes; ++notes;
else if (rvn->GetNodeType() == plVault::kNodeType_MarkerGame) else if (rvn->GetNodeType() == plVault::kNodeType_MarkerGame)
++markerGames; ++markerGames;
rvn->DecRef(); rvn->UnRef();
} }
rvnAgeJrnlz->DecRef(); rvnAgeJrnlz->UnRef();
break; break;
} }
rvnPlr->DecRef(); rvnPlr->UnRef();
break; break;
} }
@ -305,7 +305,7 @@ PyObject* pyVault::GetLinkToMyNeighborhood() const
if (RelVaultNode * rvn = VaultGetOwnedAgeLinkIncRef(&info)) { if (RelVaultNode * rvn = VaultGetOwnedAgeLinkIncRef(&info)) {
PyObject * result = pyVaultAgeLinkNode::New(rvn); PyObject * result = pyVaultAgeLinkNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
return result; return result;
} }
@ -319,7 +319,7 @@ PyObject* pyVault::GetLinkToCity() const
if (RelVaultNode * rvn = VaultGetOwnedAgeLinkIncRef(&info)) { if (RelVaultNode * rvn = VaultGetOwnedAgeLinkIncRef(&info)) {
PyObject * result = pyVaultAgeLinkNode::New(rvn); PyObject * result = pyVaultAgeLinkNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
return result; return result;
} }
@ -332,7 +332,7 @@ PyObject* pyVault::GetOwnedAgeLink( const pyAgeInfoStruct & info )
{ {
if (RelVaultNode * rvnLink = VaultGetOwnedAgeLinkIncRef(info.GetAgeInfo())) { if (RelVaultNode * rvnLink = VaultGetOwnedAgeLinkIncRef(info.GetAgeInfo())) {
PyObject * result = pyVaultAgeLinkNode::New(rvnLink); PyObject * result = pyVaultAgeLinkNode::New(rvnLink);
rvnLink->DecRef(); rvnLink->UnRef();
return result; return result;
} }
@ -345,7 +345,7 @@ PyObject* pyVault::GetVisitAgeLink( const pyAgeInfoStruct & info)
{ {
if (RelVaultNode * rvnLink = VaultGetVisitAgeLinkIncRef(info.GetAgeInfo())) { if (RelVaultNode * rvnLink = VaultGetVisitAgeLinkIncRef(info.GetAgeInfo())) {
PyObject * result = pyVaultAgeLinkNode::New(rvnLink); PyObject * result = pyVaultAgeLinkNode::New(rvnLink);
rvnLink->DecRef(); rvnLink->UnRef();
return result; return result;
} }
@ -363,7 +363,7 @@ PyObject* pyVault::FindChronicleEntry( const char * entryName )
if (RelVaultNode * rvn = VaultFindChronicleEntryIncRef(wEntryName)) { if (RelVaultNode * rvn = VaultFindChronicleEntryIncRef(wEntryName)) {
PyObject * result = pyVaultChronicleNode::New(rvn); PyObject * result = pyVaultChronicleNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
return result; return result;
} }
@ -442,7 +442,7 @@ PyObject* pyVault::GetPsnlAgeSDL() const
{ {
PyObject * result = nil; PyObject * result = nil;
NetVaultNode * templateNode = new NetVaultNode; NetVaultNode * templateNode = new NetVaultNode;
templateNode->IncRef(); templateNode->Ref();
if (RelVaultNode * rvnFldr = VaultGetAgesIOwnFolderIncRef()) { if (RelVaultNode * rvnFldr = VaultGetAgesIOwnFolderIncRef()) {
@ -465,14 +465,14 @@ PyObject* pyVault::GetPsnlAgeSDL() const
result = pySDLStateDataRecord::New(rec); result = pySDLStateDataRecord::New(rec);
else else
delete rec; delete rec;
rvnSdl->DecRef(); rvnSdl->UnRef();
} }
rvnInfo->DecRef(); rvnInfo->UnRef();
} }
rvnFldr->DecRef(); rvnFldr->UnRef();
} }
templateNode->DecRef(); templateNode->UnRef();
if (!result) if (!result)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
@ -487,7 +487,7 @@ void pyVault::UpdatePsnlAgeSDL( pySDLStateDataRecord & pyrec )
return; return;
NetVaultNode * templateNode = new NetVaultNode; NetVaultNode * templateNode = new NetVaultNode;
templateNode->IncRef(); templateNode->Ref();
if (RelVaultNode * rvnFldr = VaultGetAgesIOwnFolderIncRef()) { if (RelVaultNode * rvnFldr = VaultGetAgesIOwnFolderIncRef()) {
@ -506,14 +506,14 @@ void pyVault::UpdatePsnlAgeSDL( pySDLStateDataRecord & pyrec )
if (RelVaultNode * rvnSdl = rvnInfo->GetChildNodeIncRef(templateNode, 1)) { if (RelVaultNode * rvnSdl = rvnInfo->GetChildNodeIncRef(templateNode, 1)) {
VaultSDLNode sdl(rvnSdl); VaultSDLNode sdl(rvnSdl);
sdl.SetStateDataRecord(rec, plSDL::kDirtyOnly | plSDL::kTimeStampOnRead); sdl.SetStateDataRecord(rec, plSDL::kDirtyOnly | plSDL::kTimeStampOnRead);
rvnSdl->DecRef(); rvnSdl->UnRef();
} }
rvnInfo->DecRef(); rvnInfo->UnRef();
} }
rvnFldr->DecRef(); rvnFldr->UnRef();
} }
templateNode->DecRef(); templateNode->UnRef();
} }
bool pyVault::InMyPersonalAge() const bool pyVault::InMyPersonalAge() const
@ -600,13 +600,13 @@ void _InvitePlayerToAge(ENetError result, void* state, void* param, RelVaultNode
void pyVault::InvitePlayerToAge( const pyAgeLinkStruct & link, uint32_t playerID ) void pyVault::InvitePlayerToAge( const pyAgeLinkStruct & link, uint32_t playerID )
{ {
NetVaultNode * templateNode = new NetVaultNode; NetVaultNode * templateNode = new NetVaultNode;
templateNode->IncRef(); templateNode->Ref();
templateNode->SetNodeType(plVault::kNodeType_TextNote); templateNode->SetNodeType(plVault::kNodeType_TextNote);
VaultTextNoteNode visitAcc(templateNode); VaultTextNoteNode visitAcc(templateNode);
visitAcc.SetNoteType(plVault::kNoteType_Visit); visitAcc.SetNoteType(plVault::kNoteType_Visit);
visitAcc.SetVisitInfo(*link.GetAgeLink()->GetAgeInfo()); visitAcc.SetVisitInfo(*link.GetAgeLink()->GetAgeInfo());
VaultCreateNode(templateNode, (FVaultCreateNodeCallback)_InvitePlayerToAge, nil, (void*)playerID); VaultCreateNode(templateNode, (FVaultCreateNodeCallback)_InvitePlayerToAge, nil, (void*)playerID);
templateNode->DecRef(); templateNode->UnRef();
} }
//============================================================================ //============================================================================
@ -626,20 +626,20 @@ void pyVault::UnInvitePlayerToAge( const char * str, uint32_t playerID )
if (RelVaultNode * rvnInfo = rvnLink->GetChildNodeIncRef(plVault::kNodeType_AgeInfo, 1)) { if (RelVaultNode * rvnInfo = rvnLink->GetChildNodeIncRef(plVault::kNodeType_AgeInfo, 1)) {
VaultAgeInfoNode ageInfo(rvnInfo); VaultAgeInfoNode ageInfo(rvnInfo);
ageInfo.CopyTo(&info); ageInfo.CopyTo(&info);
rvnInfo->DecRef(); rvnInfo->UnRef();
} }
rvnLink->DecRef(); rvnLink->UnRef();
} }
NetVaultNode * templateNode = new NetVaultNode; NetVaultNode * templateNode = new NetVaultNode;
templateNode->IncRef(); templateNode->Ref();
templateNode->SetNodeType(plVault::kNodeType_TextNote); templateNode->SetNodeType(plVault::kNodeType_TextNote);
VaultTextNoteNode visitAcc(templateNode); VaultTextNoteNode visitAcc(templateNode);
visitAcc.SetNoteType(plVault::kNoteType_UnVisit); visitAcc.SetNoteType(plVault::kNoteType_UnVisit);
visitAcc.SetVisitInfo(info); visitAcc.SetVisitInfo(info);
VaultCreateNode(templateNode, (FVaultCreateNodeCallback)_UninvitePlayerToAge, nil, (void*)playerID); VaultCreateNode(templateNode, (FVaultCreateNodeCallback)_UninvitePlayerToAge, nil, (void*)playerID);
templateNode->DecRef(); templateNode->UnRef();
} }
//============================================================================ //============================================================================
@ -699,7 +699,7 @@ PyObject* pyVault::GetGlobalInbox()
PyObject * result = nil; PyObject * result = nil;
if (RelVaultNode * rvnGlobalInbox = VaultGetGlobalInboxIncRef()) { if (RelVaultNode * rvnGlobalInbox = VaultGetGlobalInboxIncRef()) {
result = pyVaultFolderNode::New(rvnGlobalInbox); result = pyVaultFolderNode::New(rvnGlobalInbox);
rvnGlobalInbox->DecRef(); rvnGlobalInbox->UnRef();
return result; return result;
} }
@ -714,7 +714,7 @@ PyObject* pyVault::FindNode( pyVaultNode* templateNode ) const
// See if we already have a matching node locally // See if we already have a matching node locally
if (RelVaultNode * rvn = VaultGetNodeIncRef(templateNode->GetNode())) { if (RelVaultNode * rvn = VaultGetNodeIncRef(templateNode->GetNode())) {
PyObject * result = pyVaultNode::New(rvn); PyObject * result = pyVaultNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
return result; return result;
} }
@ -728,7 +728,7 @@ PyObject* pyVault::FindNode( pyVaultNode* templateNode ) const
// If we fetched it successfully then it'll be in our local node cache now // If we fetched it successfully then it'll be in our local node cache now
if (RelVaultNode * rvn = VaultGetNodeIncRef(nodeIds[0])) { if (RelVaultNode * rvn = VaultGetNodeIncRef(nodeIds[0])) {
PyObject * result = pyVaultNode::New(rvn); PyObject * result = pyVaultNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
return result; return result;
} }
} }

4
Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoListNodeGlue.cpp

@ -112,10 +112,10 @@ PyObject *pyVaultAgeInfoListNode::New(RelVaultNode* nfsNode)
{ {
ptVaultAgeInfoListNode *newObj = (ptVaultAgeInfoListNode*)ptVaultAgeInfoListNode_type.tp_new(&ptVaultAgeInfoListNode_type, NULL, NULL); ptVaultAgeInfoListNode *newObj = (ptVaultAgeInfoListNode*)ptVaultAgeInfoListNode_type.tp_new(&ptVaultAgeInfoListNode_type, NULL, NULL);
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->DecRef(); newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode; newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->IncRef(); newObj->fThis->fNode->Ref();
return (PyObject*)newObj; return (PyObject*)newObj;
} }

8
Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNode.cpp

@ -80,7 +80,7 @@ static PyObject * GetChildFolder (RelVaultNode * node, unsigned type) {
PyObject * result = nil; PyObject * result = nil;
if (RelVaultNode * rvn = node->GetChildFolderNodeIncRef(type, 1)) { if (RelVaultNode * rvn = node->GetChildFolderNodeIncRef(type, 1)) {
result = pyVaultFolderNode::New(rvn); result = pyVaultFolderNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
} }
return result; return result;
} }
@ -91,7 +91,7 @@ static PyObject * GetChildPlayerInfoList (RelVaultNode * node, unsigned type) {
PyObject * result = nil; PyObject * result = nil;
if (RelVaultNode * rvn = node->GetChildPlayerInfoListNodeIncRef(type, 1)) { if (RelVaultNode * rvn = node->GetChildPlayerInfoListNodeIncRef(type, 1)) {
result = pyVaultPlayerInfoListNode::New(rvn); result = pyVaultPlayerInfoListNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
} }
return result; return result;
} }
@ -101,7 +101,7 @@ static PyObject * GetChildAgeInfoList (RelVaultNode * node, unsigned type) {
PyObject * result = nil; PyObject * result = nil;
if (RelVaultNode * rvn = node->GetChildAgeInfoListNodeIncRef(type, 1)) { if (RelVaultNode * rvn = node->GetChildAgeInfoListNodeIncRef(type, 1)) {
result = pyVaultAgeInfoListNode::New(rvn); result = pyVaultAgeInfoListNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
} }
return result; return result;
} }
@ -175,7 +175,7 @@ PyObject * pyVaultAgeInfoNode::GetParentAgeLink () const
if (RelVaultNode * rvn = fNode->GetParentAgeLinkIncRef()) { if (RelVaultNode * rvn = fNode->GetParentAgeLinkIncRef()) {
PyObject * result = pyVaultAgeLinkNode::New(rvn); PyObject * result = pyVaultAgeLinkNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
return result; return result;
} }

4
Sources/Plasma/FeatureLib/pfPython/pyVaultAgeInfoNodeGlue.cpp

@ -288,10 +288,10 @@ PyObject *pyVaultAgeInfoNode::New(RelVaultNode* nfsNode)
{ {
ptVaultAgeInfoNode *newObj = (ptVaultAgeInfoNode*)ptVaultAgeInfoNode_type.tp_new(&ptVaultAgeInfoNode_type, NULL, NULL); ptVaultAgeInfoNode *newObj = (ptVaultAgeInfoNode*)ptVaultAgeInfoNode_type.tp_new(&ptVaultAgeInfoNode_type, NULL, NULL);
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->DecRef(); newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode; newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->IncRef(); newObj->fThis->fNode->Ref();
return (PyObject*)newObj; return (PyObject*)newObj;
} }

2
Sources/Plasma/FeatureLib/pfPython/pyVaultAgeLinkNode.cpp

@ -84,7 +84,7 @@ PyObject* pyVaultAgeLinkNode::GetAgeInfo() const
PyObject * result = nil; PyObject * result = nil;
if (RelVaultNode * rvn = fNode->GetChildNodeIncRef(plVault::kNodeType_AgeInfo, 1)) { if (RelVaultNode * rvn = fNode->GetChildNodeIncRef(plVault::kNodeType_AgeInfo, 1)) {
result = pyVaultAgeInfoNode::New(rvn); result = pyVaultAgeInfoNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
} }
if (result) if (result)

4
Sources/Plasma/FeatureLib/pfPython/pyVaultAgeLinkNodeGlue.cpp

@ -201,10 +201,10 @@ PyObject *pyVaultAgeLinkNode::New(RelVaultNode* nfsNode)
{ {
ptVaultAgeLinkNode *newObj = (ptVaultAgeLinkNode*)ptVaultAgeLinkNode_type.tp_new(&ptVaultAgeLinkNode_type, NULL, NULL); ptVaultAgeLinkNode *newObj = (ptVaultAgeLinkNode*)ptVaultAgeLinkNode_type.tp_new(&ptVaultAgeLinkNode_type, NULL, NULL);
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->DecRef(); newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode; newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->IncRef(); newObj->fThis->fNode->Ref();
return (PyObject*)newObj; return (PyObject*)newObj;
} }

4
Sources/Plasma/FeatureLib/pfPython/pyVaultChronicleNodeGlue.cpp

@ -191,10 +191,10 @@ PyObject *pyVaultChronicleNode::New(RelVaultNode* nfsNode)
{ {
ptVaultChronicleNode *newObj = (ptVaultChronicleNode*)ptVaultChronicleNode_type.tp_new(&ptVaultChronicleNode_type, NULL, NULL); ptVaultChronicleNode *newObj = (ptVaultChronicleNode*)ptVaultChronicleNode_type.tp_new(&ptVaultChronicleNode_type, NULL, NULL);
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->DecRef(); newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode; newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->IncRef(); newObj->fThis->fNode->Ref();
return (PyObject*)newObj; return (PyObject*)newObj;
} }

4
Sources/Plasma/FeatureLib/pfPython/pyVaultFolderNodeGlue.cpp

@ -192,10 +192,10 @@ PyObject *pyVaultFolderNode::New(RelVaultNode* nfsNode)
{ {
ptVaultFolderNode *newObj = (ptVaultFolderNode*)ptVaultFolderNode_type.tp_new(&ptVaultFolderNode_type, NULL, NULL); ptVaultFolderNode *newObj = (ptVaultFolderNode*)ptVaultFolderNode_type.tp_new(&ptVaultFolderNode_type, NULL, NULL);
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->DecRef(); newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode; newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->IncRef(); newObj->fThis->fNode->Ref();
return (PyObject*)newObj; return (PyObject*)newObj;
} }

4
Sources/Plasma/FeatureLib/pfPython/pyVaultImageNodeGlue.cpp

@ -220,10 +220,10 @@ PyObject *pyVaultImageNode::New(RelVaultNode* nfsNode)
{ {
ptVaultImageNode *newObj = (ptVaultImageNode*)ptVaultImageNode_type.tp_new(&ptVaultImageNode_type, NULL, NULL); ptVaultImageNode *newObj = (ptVaultImageNode*)ptVaultImageNode_type.tp_new(&ptVaultImageNode_type, NULL, NULL);
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->DecRef(); newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode; newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->IncRef(); newObj->fThis->fNode->Ref();
return (PyObject*)newObj; return (PyObject*)newObj;
} }

4
Sources/Plasma/FeatureLib/pfPython/pyVaultMarkerGameNodeGlue.cpp

@ -115,10 +115,10 @@ PyObject *pyVaultMarkerGameNode::New(RelVaultNode* nfsNode)
{ {
ptVaultMarkerGameNode *newObj = (ptVaultMarkerGameNode*)ptVaultMarkerGameNode_type.tp_new(&ptVaultMarkerGameNode_type, NULL, NULL); ptVaultMarkerGameNode *newObj = (ptVaultMarkerGameNode*)ptVaultMarkerGameNode_type.tp_new(&ptVaultMarkerGameNode_type, NULL, NULL);
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->DecRef(); newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode; newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->IncRef(); newObj->fThis->fNode->Ref();
return (PyObject*)newObj; return (PyObject*)newObj;
} }

42
Sources/Plasma/FeatureLib/pfPython/pyVaultNode.cpp

@ -159,10 +159,10 @@ void pyVaultNode::pyVaultNodeOperationCallback::VaultOperationComplete( uint32_t
void pyVaultNode::pyVaultNodeOperationCallback::SetNode (RelVaultNode * rvn) { void pyVaultNode::pyVaultNodeOperationCallback::SetNode (RelVaultNode * rvn) {
if (rvn) if (rvn)
rvn->IncRef(); rvn->Ref();
SWAP(rvn, fNode); SWAP(rvn, fNode);
if (rvn) if (rvn)
rvn->DecRef(); rvn->UnRef();
} }
RelVaultNode * pyVaultNode::pyVaultNodeOperationCallback::GetNode () { RelVaultNode * pyVaultNode::pyVaultNodeOperationCallback::GetNode () {
@ -182,13 +182,13 @@ pyVaultNode::pyVaultNode( RelVaultNode* nfsNode )
, fCreateAgeName(nil) , fCreateAgeName(nil)
{ {
if (fNode) if (fNode)
fNode->IncRef("pyVaultNode"); fNode->Ref("pyVaultNode");
} }
pyVaultNode::~pyVaultNode() pyVaultNode::~pyVaultNode()
{ {
if (fNode) if (fNode)
fNode->DecRef("pyVaultNode"); fNode->UnRef("pyVaultNode");
free(fCreateAgeName); free(fCreateAgeName);
} }
@ -271,16 +271,16 @@ PyObject* pyVaultNode::GetCreatorNode( void )
if (fNode) if (fNode)
{ {
RelVaultNode * templateNode = new RelVaultNode; RelVaultNode * templateNode = new RelVaultNode;
templateNode->IncRef(); templateNode->Ref();
templateNode->SetNodeType(plVault::kNodeType_PlayerInfo); templateNode->SetNodeType(plVault::kNodeType_PlayerInfo);
VaultPlayerInfoNode plrInfo(templateNode); VaultPlayerInfoNode plrInfo(templateNode);
plrInfo.SetPlayerId(fNode->GetCreatorId()); plrInfo.SetPlayerId(fNode->GetCreatorId());
if (RelVaultNode * rvn = VaultGetNodeIncRef(templateNode)) { if (RelVaultNode * rvn = VaultGetNodeIncRef(templateNode)) {
result = pyVaultPlayerInfoNode::New(rvn); result = pyVaultPlayerInfoNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
} }
templateNode->DecRef(); templateNode->UnRef();
} }
if (result) if (result)
@ -423,8 +423,8 @@ PyObject* pyVaultNode::AddNode(pyVaultNode* pynode, PyObject* cbObject, uint32_t
); );
if (newNode) { if (newNode) {
newNode->IncRef(); newNode->Ref();
pynode->fNode->DecRef(); pynode->fNode->UnRef();
pynode->fNode = newNode; pynode->fNode = newNode;
} }
else { else {
@ -471,7 +471,7 @@ void pyVaultNode::LinkToNode(int nodeID, PyObject* cbObject, uint32_t cbContext)
if (RelVaultNode * rvn = VaultGetNodeIncRef(nodeID)) { if (RelVaultNode * rvn = VaultGetNodeIncRef(nodeID)) {
cb->SetNode(rvn); cb->SetNode(rvn);
cb->fPyNodeRef = pyVaultNodeRef::New(fNode, rvn); cb->fPyNodeRef = pyVaultNodeRef::New(fNode, rvn);
rvn->DecRef(); rvn->UnRef();
} }
VaultAddChildNode(fNode->GetNodeId(), VaultAddChildNode(fNode->GetNodeId(),
@ -536,7 +536,7 @@ void pyVaultNode::Save(PyObject* cbObject, uint32_t cbContext)
if (!fNode->GetNodeId() && fNode->GetNodeType()) { if (!fNode->GetNodeId() && fNode->GetNodeType()) {
ENetError result; ENetError result;
if (RelVaultNode * node = VaultCreateNodeAndWaitIncRef(fNode, &result)) { if (RelVaultNode * node = VaultCreateNodeAndWaitIncRef(fNode, &result)) {
fNode->DecRef(); fNode->UnRef();
fNode = node; fNode = node;
} }
} }
@ -560,7 +560,7 @@ void pyVaultNode::ForceSave()
if (!fNode->GetNodeId() && fNode->GetNodeType()) { if (!fNode->GetNodeId() && fNode->GetNodeType()) {
ENetError result; ENetError result;
if (RelVaultNode * node = VaultCreateNodeAndWaitIncRef(fNode, &result)) { if (RelVaultNode * node = VaultCreateNodeAndWaitIncRef(fNode, &result)) {
fNode->DecRef(); fNode->UnRef();
fNode = node; fNode = node;
} }
} }
@ -579,7 +579,7 @@ void pyVaultNode::SendTo(uint32_t destClientNodeID, PyObject* cbObject, uint32_t
if (!fNode->GetNodeId() && fNode->GetNodeType()) { if (!fNode->GetNodeId() && fNode->GetNodeType()) {
ENetError result; ENetError result;
if (RelVaultNode * node = VaultCreateNodeAndWaitIncRef(fNode, &result)) { if (RelVaultNode * node = VaultCreateNodeAndWaitIncRef(fNode, &result)) {
fNode->DecRef(); fNode->UnRef();
fNode = node; fNode = node;
} }
} }
@ -618,7 +618,7 @@ PyObject* pyVaultNode::GetChildNodeRefList()
PyObject* elementObj = pyVaultNodeRef::New(fNode, nodes[i]); PyObject* elementObj = pyVaultNodeRef::New(fNode, nodes[i]);
PyList_Append(pyEL, elementObj); PyList_Append(pyEL, elementObj);
Py_DECREF(elementObj); Py_DECREF(elementObj);
nodes[i]->DecRef(); nodes[i]->UnRef();
} }
} }
@ -657,13 +657,13 @@ PyObject * pyVaultNode::GetNode2( uint32_t nodeID ) const
if ( fNode ) if ( fNode )
{ {
RelVaultNode * templateNode = new RelVaultNode; RelVaultNode * templateNode = new RelVaultNode;
templateNode->IncRef(); templateNode->Ref();
templateNode->SetNodeId(nodeID); templateNode->SetNodeId(nodeID);
if (RelVaultNode * rvn = fNode->GetChildNodeIncRef(templateNode, 1)) { if (RelVaultNode * rvn = fNode->GetChildNodeIncRef(templateNode, 1)) {
result = pyVaultNodeRef::New(fNode, rvn); result = pyVaultNodeRef::New(fNode, rvn);
rvn->DecRef(); rvn->UnRef();
} }
templateNode->DecRef(); templateNode->UnRef();
} }
if (result) if (result)
@ -679,7 +679,7 @@ PyObject* pyVaultNode::FindNode( pyVaultNode * templateNode )
{ {
if (RelVaultNode * rvn = fNode->GetChildNodeIncRef(templateNode->fNode, 1)) { if (RelVaultNode * rvn = fNode->GetChildNodeIncRef(templateNode->fNode, 1)) {
result = pyVaultNode::New(rvn); result = pyVaultNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
} }
} }
@ -695,14 +695,14 @@ PyObject * pyVaultNode::GetChildNode (unsigned nodeId) {
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
RelVaultNode * templateNode = new RelVaultNode; RelVaultNode * templateNode = new RelVaultNode;
templateNode->IncRef(); templateNode->Ref();
templateNode->SetNodeId(nodeId); templateNode->SetNodeId(nodeId);
RelVaultNode * rvn = fNode->GetChildNodeIncRef(templateNode, 1); RelVaultNode * rvn = fNode->GetChildNodeIncRef(templateNode, 1);
templateNode->DecRef(); templateNode->UnRef();
if (rvn) { if (rvn) {
PyObject * result = pyVaultNode::New(rvn); PyObject * result = pyVaultNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
return result; return result;
} }

4
Sources/Plasma/FeatureLib/pfPython/pyVaultNodeGlue.cpp

@ -542,10 +542,10 @@ PyObject *pyVaultNode::New(RelVaultNode* nfsNode)
{ {
ptVaultNode *newObj = (ptVaultNode*)ptVaultNode_type.tp_new(&ptVaultNode_type, NULL, NULL); ptVaultNode *newObj = (ptVaultNode*)ptVaultNode_type.tp_new(&ptVaultNode_type, NULL, NULL);
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->DecRef(); newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode; newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->IncRef(); newObj->fThis->fNode->Ref();
return (PyObject*)newObj; return (PyObject*)newObj;
} }

18
Sources/Plasma/FeatureLib/pfPython/pyVaultNodeRef.cpp

@ -65,8 +65,8 @@ pyVaultNodeRef::pyVaultNodeRef(RelVaultNode * parent, RelVaultNode * child)
: fParent(parent) : fParent(parent)
, fChild(child) , fChild(child)
{ {
fParent->IncRef(); fParent->Ref();
fChild->IncRef(); fChild->Ref();
} }
pyVaultNodeRef::pyVaultNodeRef(int) pyVaultNodeRef::pyVaultNodeRef(int)
@ -78,9 +78,9 @@ pyVaultNodeRef::pyVaultNodeRef(int)
pyVaultNodeRef::~pyVaultNodeRef() pyVaultNodeRef::~pyVaultNodeRef()
{ {
if (fParent) if (fParent)
fParent->DecRef(); fParent->UnRef();
if (fChild) if (fChild)
fChild->DecRef(); fChild->UnRef();
} }
@ -115,7 +115,7 @@ unsigned pyVaultNodeRef::GetSaverID () {
unsigned saverId = 0; unsigned saverId = 0;
if (RelVaultNode * child = VaultGetNodeIncRef(fChild->GetNodeId())) { if (RelVaultNode * child = VaultGetNodeIncRef(fChild->GetNodeId())) {
saverId = child->GetRefOwnerId(fParent->GetNodeId()); saverId = child->GetRefOwnerId(fParent->GetNodeId());
child->DecRef(); child->UnRef();
} }
return saverId; return saverId;
} }
@ -129,7 +129,7 @@ PyObject * pyVaultNodeRef::GetSaver () {
if (unsigned saverId = child->GetRefOwnerId(fParent->GetNodeId())) { if (unsigned saverId = child->GetRefOwnerId(fParent->GetNodeId())) {
// Find the player info node representing the saver // Find the player info node representing the saver
NetVaultNode * templateNode = new NetVaultNode; NetVaultNode * templateNode = new NetVaultNode;
templateNode->IncRef(); templateNode->Ref();
templateNode->SetNodeType(plVault::kNodeType_PlayerInfo); templateNode->SetNodeType(plVault::kNodeType_PlayerInfo);
VaultPlayerInfoNode access(templateNode); VaultPlayerInfoNode access(templateNode);
access.SetPlayerId(saverId); access.SetPlayerId(saverId);
@ -144,15 +144,15 @@ PyObject * pyVaultNodeRef::GetSaver () {
} }
} }
templateNode->DecRef(); templateNode->UnRef();
} }
child->DecRef(); child->UnRef();
} }
if (!saver) if (!saver)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
PyObject * result = pyVaultPlayerInfoNode::New(saver); PyObject * result = pyVaultPlayerInfoNode::New(saver);
saver->DecRef(); saver->UnRef();
return result; return result;
} }

8
Sources/Plasma/FeatureLib/pfPython/pyVaultNodeRefGlue.cpp

@ -126,15 +126,15 @@ PyObject *pyVaultNodeRef::New(RelVaultNode * parent, RelVaultNode * child)
{ {
ptVaultNodeRef *newObj = (ptVaultNodeRef*)ptVaultNodeRef_type.tp_new(&ptVaultNodeRef_type, NULL, NULL); ptVaultNodeRef *newObj = (ptVaultNodeRef*)ptVaultNodeRef_type.tp_new(&ptVaultNodeRef_type, NULL, NULL);
if (newObj->fThis->fParent) if (newObj->fThis->fParent)
newObj->fThis->fParent->DecRef(); newObj->fThis->fParent->UnRef();
if (newObj->fThis->fChild) if (newObj->fThis->fChild)
newObj->fThis->fChild->DecRef(); newObj->fThis->fChild->UnRef();
newObj->fThis->fParent = parent; newObj->fThis->fParent = parent;
newObj->fThis->fChild = child; newObj->fThis->fChild = child;
if (newObj->fThis->fParent) if (newObj->fThis->fParent)
newObj->fThis->fParent->IncRef(); newObj->fThis->fParent->Ref();
if (newObj->fThis->fChild) if (newObj->fThis->fChild)
newObj->fThis->fChild->IncRef(); newObj->fThis->fChild->Ref();
return (PyObject*)newObj; return (PyObject*)newObj;
} }

24
Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoListNode.cpp

@ -80,16 +80,16 @@ bool pyVaultPlayerInfoListNode::HasPlayer( uint32_t playerID )
return false; return false;
NetVaultNode * templateNode = new NetVaultNode; NetVaultNode * templateNode = new NetVaultNode;
templateNode->IncRef(); templateNode->Ref();
templateNode->SetNodeType(plVault::kNodeType_PlayerInfo); templateNode->SetNodeType(plVault::kNodeType_PlayerInfo);
VaultPlayerInfoNode access(templateNode); VaultPlayerInfoNode access(templateNode);
access.SetPlayerId(playerID); access.SetPlayerId(playerID);
RelVaultNode * rvn = fNode->GetChildNodeIncRef(templateNode, 1); RelVaultNode * rvn = fNode->GetChildNodeIncRef(templateNode, 1);
if (rvn) if (rvn)
rvn->DecRef(); rvn->UnRef();
templateNode->DecRef(); templateNode->UnRef();
return (rvn != nil); return (rvn != nil);
} }
@ -100,7 +100,7 @@ static void IAddPlayer_NodesFound(ENetError result, void* param, unsigned nodeId
NetVaultNode* parent = static_cast<NetVaultNode*>(param); NetVaultNode* parent = static_cast<NetVaultNode*>(param);
if (nodeIdCount) if (nodeIdCount)
VaultAddChildNode(parent->GetNodeId(), nodeIds[0], VaultGetPlayerId(), nullptr, nullptr); VaultAddChildNode(parent->GetNodeId(), nodeIds[0], VaultGetPlayerId(), nullptr, nullptr);
parent->DecRef(); parent->UnRef();
} }
void pyVaultPlayerInfoListNode::AddPlayer( uint32_t playerID ) void pyVaultPlayerInfoListNode::AddPlayer( uint32_t playerID )
@ -109,7 +109,7 @@ void pyVaultPlayerInfoListNode::AddPlayer( uint32_t playerID )
return; return;
NetVaultNode* templateNode = new NetVaultNode(); NetVaultNode* templateNode = new NetVaultNode();
templateNode->IncRef(); templateNode->Ref();
templateNode->SetNodeType(plVault::kNodeType_PlayerInfo); templateNode->SetNodeType(plVault::kNodeType_PlayerInfo);
VaultPlayerInfoNode access(templateNode); VaultPlayerInfoNode access(templateNode);
access.SetPlayerId(playerID); access.SetPlayerId(playerID);
@ -121,7 +121,7 @@ void pyVaultPlayerInfoListNode::AddPlayer( uint32_t playerID )
if (nodeIds.Count()) if (nodeIds.Count())
VaultAddChildNode(fNode->GetNodeId(), nodeIds[0], VaultGetPlayerId(), nullptr, nullptr); VaultAddChildNode(fNode->GetNodeId(), nodeIds[0], VaultGetPlayerId(), nullptr, nullptr);
else { else {
fNode->IncRef(); fNode->Ref();
VaultFindNodes(templateNode, IAddPlayer_NodesFound, fNode); VaultFindNodes(templateNode, IAddPlayer_NodesFound, fNode);
} }
} }
@ -132,17 +132,17 @@ void pyVaultPlayerInfoListNode::RemovePlayer( uint32_t playerID )
return; return;
NetVaultNode * templateNode = new NetVaultNode; NetVaultNode * templateNode = new NetVaultNode;
templateNode->IncRef(); templateNode->Ref();
templateNode->SetNodeType(plVault::kNodeType_PlayerInfo); templateNode->SetNodeType(plVault::kNodeType_PlayerInfo);
VaultPlayerInfoNode access(templateNode); VaultPlayerInfoNode access(templateNode);
access.SetPlayerId(playerID); access.SetPlayerId(playerID);
if (RelVaultNode * rvn = fNode->GetChildNodeIncRef(templateNode, 1)) { if (RelVaultNode * rvn = fNode->GetChildNodeIncRef(templateNode, 1)) {
VaultRemoveChildNode(fNode->GetNodeId(), rvn->GetNodeId(), nil, nil); VaultRemoveChildNode(fNode->GetNodeId(), rvn->GetNodeId(), nil, nil);
rvn->DecRef(); rvn->UnRef();
} }
templateNode->DecRef(); templateNode->UnRef();
} }
PyObject * pyVaultPlayerInfoListNode::GetPlayer( uint32_t playerID ) PyObject * pyVaultPlayerInfoListNode::GetPlayer( uint32_t playerID )
@ -151,7 +151,7 @@ PyObject * pyVaultPlayerInfoListNode::GetPlayer( uint32_t playerID )
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
NetVaultNode * templateNode = new NetVaultNode; NetVaultNode * templateNode = new NetVaultNode;
templateNode->IncRef(); templateNode->Ref();
templateNode->SetNodeType(plVault::kNodeType_PlayerInfo); templateNode->SetNodeType(plVault::kNodeType_PlayerInfo);
VaultPlayerInfoNode access(templateNode); VaultPlayerInfoNode access(templateNode);
access.SetPlayerId(playerID); access.SetPlayerId(playerID);
@ -159,10 +159,10 @@ PyObject * pyVaultPlayerInfoListNode::GetPlayer( uint32_t playerID )
PyObject * result = nil; PyObject * result = nil;
if (RelVaultNode * rvn = fNode->GetChildNodeIncRef(templateNode, 1)) { if (RelVaultNode * rvn = fNode->GetChildNodeIncRef(templateNode, 1)) {
result = pyVaultPlayerInfoNode::New(rvn); result = pyVaultPlayerInfoNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
} }
templateNode->DecRef(); templateNode->UnRef();
if (!result) if (!result)
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;

4
Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoListNodeGlue.cpp

@ -180,10 +180,10 @@ PyObject *pyVaultPlayerInfoListNode::New(RelVaultNode* nfsNode)
{ {
ptVaultPlayerInfoListNode *newObj = (ptVaultPlayerInfoListNode*)ptVaultPlayerInfoListNode_type.tp_new(&ptVaultPlayerInfoListNode_type, NULL, NULL); ptVaultPlayerInfoListNode *newObj = (ptVaultPlayerInfoListNode*)ptVaultPlayerInfoListNode_type.tp_new(&ptVaultPlayerInfoListNode_type, NULL, NULL);
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->DecRef(); newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode; newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->IncRef(); newObj->fThis->fNode->Ref();
return (PyObject*)newObj; return (PyObject*)newObj;
} }

4
Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerInfoNodeGlue.cpp

@ -172,10 +172,10 @@ PyObject *pyVaultPlayerInfoNode::New(RelVaultNode* nfsNode)
{ {
ptVaultPlayerInfoNode *newObj = (ptVaultPlayerInfoNode*)ptVaultPlayerInfoNode_type.tp_new(&ptVaultPlayerInfoNode_type, NULL, NULL); ptVaultPlayerInfoNode *newObj = (ptVaultPlayerInfoNode*)ptVaultPlayerInfoNode_type.tp_new(&ptVaultPlayerInfoNode_type, NULL, NULL);
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->DecRef(); newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode; newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->IncRef(); newObj->fThis->fNode->Ref();
return (PyObject*)newObj; return (PyObject*)newObj;
} }

10
Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNode.cpp

@ -68,9 +68,9 @@ static PyObject * GetPlayerVaultFolder (unsigned folderType) {
if (RelVaultNode * rvnPlr = VaultGetPlayerNodeIncRef()) { if (RelVaultNode * rvnPlr = VaultGetPlayerNodeIncRef()) {
if (RelVaultNode * rvnFldr = rvnPlr->GetChildFolderNodeIncRef(folderType, 1)) { if (RelVaultNode * rvnFldr = rvnPlr->GetChildFolderNodeIncRef(folderType, 1)) {
result = pyVaultFolderNode::New(rvnFldr); result = pyVaultFolderNode::New(rvnFldr);
rvnFldr->DecRef(); rvnFldr->UnRef();
} }
rvnPlr->DecRef(); rvnPlr->UnRef();
} }
return result; return result;
@ -174,7 +174,7 @@ PyObject *pyVaultPlayerNode::GetPlayerInfo()
{ {
if (RelVaultNode * rvn = VaultGetPlayerInfoNodeIncRef()) { if (RelVaultNode * rvn = VaultGetPlayerInfoNodeIncRef()) {
PyObject * result = pyVaultPlayerInfoNode::New(rvn); PyObject * result = pyVaultPlayerInfoNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
return result; return result;
} }
@ -223,7 +223,7 @@ PyObject *pyVaultPlayerNode::GetVisitAgeLink(const pyAgeInfoStruct *info)
{ {
if (RelVaultNode * rvn = VaultGetVisitAgeLinkIncRef(info->GetAgeInfo())) { if (RelVaultNode * rvn = VaultGetVisitAgeLinkIncRef(info->GetAgeInfo())) {
PyObject * result = pyVaultAgeLinkNode::New(rvn); PyObject * result = pyVaultAgeLinkNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
return result; return result;
} }
@ -244,7 +244,7 @@ PyObject *pyVaultPlayerNode::FindChronicleEntry(const char *entryName)
StrToUnicode(wStr, entryName, arrsize(wStr)); StrToUnicode(wStr, entryName, arrsize(wStr));
if (RelVaultNode * rvn = VaultFindChronicleEntryIncRef(wStr)) { if (RelVaultNode * rvn = VaultFindChronicleEntryIncRef(wStr)) {
PyObject * result = pyVaultChronicleNode::New(rvn); PyObject * result = pyVaultChronicleNode::New(rvn);
rvn->DecRef(); rvn->UnRef();
return result; return result;
} }

4
Sources/Plasma/FeatureLib/pfPython/pyVaultPlayerNodeGlue.cpp

@ -322,10 +322,10 @@ PyObject *pyVaultPlayerNode::New(RelVaultNode* nfsNode)
{ {
ptVaultPlayerNode *newObj = (ptVaultPlayerNode*)ptVaultPlayerNode_type.tp_new(&ptVaultPlayerNode_type, NULL, NULL); ptVaultPlayerNode *newObj = (ptVaultPlayerNode*)ptVaultPlayerNode_type.tp_new(&ptVaultPlayerNode_type, NULL, NULL);
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->DecRef(); newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode; newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->IncRef(); newObj->fThis->fNode->Ref();
return (PyObject*)newObj; return (PyObject*)newObj;
} }

4
Sources/Plasma/FeatureLib/pfPython/pyVaultSDLNodeGlue.cpp

@ -130,10 +130,10 @@ PyObject *pyVaultSDLNode::New(RelVaultNode* nfsNode)
{ {
ptVaultSDLNode *newObj = (ptVaultSDLNode*)ptVaultSDLNode_type.tp_new(&ptVaultSDLNode_type, NULL, NULL); ptVaultSDLNode *newObj = (ptVaultSDLNode*)ptVaultSDLNode_type.tp_new(&ptVaultSDLNode_type, NULL, NULL);
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->DecRef(); newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode; newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->IncRef(); newObj->fThis->fNode->Ref();
return (PyObject*)newObj; return (PyObject*)newObj;
} }

4
Sources/Plasma/FeatureLib/pfPython/pyVaultSystemNodeGlue.cpp

@ -71,10 +71,10 @@ PyObject *pyVaultSystemNode::New(RelVaultNode* nfsNode)
{ {
ptVaultSystemNode *newObj = (ptVaultSystemNode*)ptVaultSystemNode_type.tp_new(&ptVaultSystemNode_type, NULL, NULL); ptVaultSystemNode *newObj = (ptVaultSystemNode*)ptVaultSystemNode_type.tp_new(&ptVaultSystemNode_type, NULL, NULL);
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->DecRef(); newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode; newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->IncRef(); newObj->fThis->fNode->Ref();
return (PyObject*)newObj; return (PyObject*)newObj;
} }

2
Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNode.cpp

@ -230,7 +230,7 @@ void pyVaultTextNoteNode::SetDeviceInbox( const char * devName, PyObject * cbObj
if (RelVaultNode * rvn = VaultAgeSetDeviceInboxAndWaitIncRef(wDev, DEFAULT_DEVICE_INBOX)) { if (RelVaultNode * rvn = VaultAgeSetDeviceInboxAndWaitIncRef(wDev, DEFAULT_DEVICE_INBOX)) {
cb->SetNode(rvn); cb->SetNode(rvn);
rvn->DecRef(); rvn->UnRef();
} }
cb->VaultOperationComplete( cbContext, cb->GetNode() ? hsOK : hsFail ); // cbHolder deletes itself here. cb->VaultOperationComplete( cbContext, cb->GetNode() ? hsOK : hsFail ); // cbHolder deletes itself here.

4
Sources/Plasma/FeatureLib/pfPython/pyVaultTextNoteNodeGlue.cpp

@ -319,10 +319,10 @@ PyObject *pyVaultTextNoteNode::New(RelVaultNode* nfsNode)
{ {
ptVaultTextNoteNode *newObj = (ptVaultTextNoteNode*)ptVaultTextNoteNode_type.tp_new(&ptVaultTextNoteNode_type, NULL, NULL); ptVaultTextNoteNode *newObj = (ptVaultTextNoteNode*)ptVaultTextNoteNode_type.tp_new(&ptVaultTextNoteNode_type, NULL, NULL);
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->DecRef(); newObj->fThis->fNode->UnRef();
newObj->fThis->fNode = nfsNode; newObj->fThis->fNode = nfsNode;
if (newObj->fThis->fNode) if (newObj->fThis->fNode)
newObj->fThis->fNode->IncRef(); newObj->fThis->fNode->Ref();
return (PyObject*)newObj; return (PyObject*)newObj;
} }

15
Sources/Plasma/NucleusLib/pnNetCli/pnNcChannel.cpp

@ -48,6 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "Pch.h" #include "Pch.h"
#include "hsThread.h" #include "hsThread.h"
#include <list> #include <list>
#include "hsRefCnt.h"
#pragma hdrstop #pragma hdrstop
@ -72,7 +73,7 @@ private:
hsMutex m_critsect; hsMutex m_critsect;
}; };
struct NetMsgChannel : AtomicRef { struct NetMsgChannel : hsAtomicRefCnt {
uint32_t m_protocol; uint32_t m_protocol;
bool m_server; bool m_server;
@ -109,7 +110,7 @@ ChannelCrit::~ChannelCrit () {
while (s_channels->size()) { while (s_channels->size()) {
NetMsgChannel* const channel = s_channels->front(); NetMsgChannel* const channel = s_channels->front();
s_channels->remove(channel); s_channels->remove(channel);
channel->DecRef("ChannelLink"); channel->UnRef("ChannelLink");
} }
delete s_channels; delete s_channels;
@ -275,7 +276,7 @@ static NetMsgChannel* FindOrCreateChannel_CS (uint32_t protocol, bool server) {
channel->m_largestRecv = 0; channel->m_largestRecv = 0;
s_channels->push_back(channel); s_channels->push_back(channel);
channel->IncRef("ChannelLink"); channel->Ref("ChannelLink");
} }
return channel; return channel;
@ -298,7 +299,7 @@ NetMsgChannel * NetMsgChannelLock (
s_channelCrit.Enter(); s_channelCrit.Enter();
if (nil != (channel = FindChannel_CS(protocol, server))) { if (nil != (channel = FindChannel_CS(protocol, server))) {
*largestRecv = channel->m_largestRecv; *largestRecv = channel->m_largestRecv;
channel->IncRef("ChannelLock"); channel->Ref("ChannelLock");
} }
else { else {
*largestRecv = 0; *largestRecv = 0;
@ -313,7 +314,7 @@ void NetMsgChannelUnlock (
) { ) {
s_channelCrit.Enter(); s_channelCrit.Enter();
{ {
channel->DecRef("ChannelLock"); channel->UnRef("ChannelLock");
} }
s_channelCrit.Leave(); s_channelCrit.Leave();
} }
@ -392,7 +393,7 @@ void NetMsgProtocolRegister (
// make sure no connections have been established on this protocol, otherwise // make sure no connections have been established on this protocol, otherwise
// we'll be modifying a live data structure; NetCli's don't lock their protocol // we'll be modifying a live data structure; NetCli's don't lock their protocol
// to operate on it once they have linked to it! // to operate on it once they have linked to it!
ASSERT(channel->GetRefCount() == 1); ASSERT(channel->RefCnt() == 1);
channel->m_dh_g = dh_g; channel->m_dh_g = dh_g;
channel->m_dh_xa = dh_xa; channel->m_dh_xa = dh_xa;
@ -411,7 +412,7 @@ void NetMsgProtocolDestroy (uint32_t protocol, bool server) {
s_channelCrit.EnterSafe(); s_channelCrit.EnterSafe();
if (NetMsgChannel* channel = FindChannel_CS(protocol, server)) { if (NetMsgChannel* channel = FindChannel_CS(protocol, server)) {
s_channels->remove(channel); s_channels->remove(channel);
channel->DecRef("ChannelLink"); channel->UnRef("ChannelLink");
} }
s_channelCrit.LeaveSafe(); s_channelCrit.LeaveSafe();
} }

3
Sources/Plasma/NucleusLib/pnNetProtocol/Private/pnNpCommon.h

@ -51,6 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PNNPCOMMON_H #define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNNETPROTOCOL_PRIVATE_PNNPCOMMON_H
#include "pnUUID/pnUUID.h" #include "pnUUID/pnUUID.h"
#include "hsRefCnt.h"
/***************************************************************************** /*****************************************************************************
@ -156,7 +157,7 @@ struct NetGameRank {
// NetVaultNode // NetVaultNode
//============================================================================ //============================================================================
// Threaded apps: App is responsible for locking node->critsect before accessing *any* field in this struct // Threaded apps: App is responsible for locking node->critsect before accessing *any* field in this struct
struct NetVaultNode : AtomicRef { struct NetVaultNode : hsAtomicRefCnt {
enum RwOptions { enum RwOptions {
kRwDirtyOnly = 1<<0, // READ : No meaning kRwDirtyOnly = 1<<0, // READ : No meaning
// WRITE: Only write fields marked dirty // WRITE: Only write fields marked dirty

1
Sources/Plasma/NucleusLib/pnUtils/CMakeLists.txt

@ -14,7 +14,6 @@ set(pnUtils_HEADERS
pnUtMisc.h pnUtMisc.h
pnUtPragma.h pnUtPragma.h
pnUtPriQ.h pnUtPriQ.h
pnUtRef.h
pnUtSort.h pnUtSort.h
pnUtStr.h pnUtStr.h
pnUtTime.h pnUtTime.h

1
Sources/Plasma/NucleusLib/pnUtils/pnUtAllIncludes.h

@ -58,7 +58,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pnUtPriQ.h" #include "pnUtPriQ.h"
#include "pnUtTime.h" #include "pnUtTime.h"
#include "pnUtStr.h" #include "pnUtStr.h"
#include "pnUtRef.h"
#include "pnUtCmd.h" #include "pnUtCmd.h"
#include "pnUtMisc.h" #include "pnUtMisc.h"
#include "pnUtCrypt.h" #include "pnUtCrypt.h"

180
Sources/Plasma/NucleusLib/pnUtils/pnUtRef.h

@ -1,180 +0,0 @@
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
You can contact Cyan Worlds, Inc. by email legal@cyan.com
or by snail mail at:
Cyan Worlds, Inc.
14617 N Newport Hwy
Mead, WA 99021
*==LICENSE==*/
/*****************************************************************************
*
* $/Plasma20/Sources/Plasma/NucleusLib/pnUtils/Private/pnUtRef.h
*
***/
#ifndef PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTREF_H
#define PLASMA20_SOURCES_PLASMA_NUCLEUSLIB_PNUTILS_PRIVATE_PNUTREF_H
/****************************************************************************
*
* AtomicRef
* Thread safe reference count
*
***/
class AtomicRef {
#ifdef HS_DEBUGGING
bool zeroed;
#endif
public:
inline AtomicRef ()
: m_ref(0)
#ifdef HS_DEBUGGING
, zeroed(false)
#endif
{}
inline void AcknowledgeZeroRef () {
#ifdef HS_DEBUGGING
zeroed = false;
#endif
}
inline long IncRef () {
#ifdef HS_DEBUGGING
ASSERT(!zeroed);
#endif
long prev = AtomicAdd(&m_ref, 1);
#ifdef REFCOUNT_DEBUGGING
DEBUG_MSG("Inc %p: %u", this, prev+1);
#endif
return prev+1;
}
inline long IncRef (const char tag[]) {
#ifdef HS_DEBUGGING
ASSERT(!zeroed);
#endif
long prev = AtomicAdd(&m_ref, 1);
#ifdef REFCOUNT_DEBUGGING
DEBUG_MSG("Inc %p %s: %u", this, tag, prev+1);
#endif
return prev+1;
}
inline long IncRef (unsigned n) {
#ifdef HS_DEBUGGING
ASSERT(!zeroed);
#endif
long prev = AtomicAdd(&m_ref, n);
#ifdef REFCOUNT_DEBUGGING
DEBUG_MSG("Inc %p: %u", this, prev+n);
#endif
return prev+n;
}
inline long IncRef (unsigned n, const char tag[]) {
#ifdef HS_DEBUGGING
ASSERT(!zeroed);
#endif
long prev = AtomicAdd(&m_ref, n);
#ifdef REFCOUNT_DEBUGGING
DEBUG_MSG("Inc %p %s: %u", this, tag, prev+n);
#endif
return prev+n;
}
inline long DecRef () {
#ifdef HS_DEBUGGING
ASSERT(!zeroed);
#endif
long prev;
if ((prev = AtomicAdd(&m_ref, -1)) == 1) {
#ifdef HS_DEBUGGING
zeroed = true;
#endif
OnZeroRef();
}
#ifdef REFCOUNT_DEBUGGING
DEBUG_MSG("Dec %p: %u", this, prev-1);
#endif
return prev-1;
}
inline long DecRef (const char tag[]) {
#ifdef HS_DEBUGGING
ASSERT(!zeroed);
#endif
long prev;
if ((prev = AtomicAdd(&m_ref, -1)) == 1) {
#ifdef HS_DEBUGGING
zeroed = true;
#endif
OnZeroRef();
}
#ifdef REFCOUNT_DEBUGGING
DEBUG_MSG("Dec %p %s: %u", this, tag, prev-1);
#endif
return prev-1;
}
inline void TransferRef (
const char oldTag[],
const char newTag[]
) {
#ifdef HS_DEBUGGING
ASSERT(!zeroed);
#endif
#ifdef REFCOUNT_DEBUGGING
DEBUG_MSG("Inc %p %s: (xfer)", this, newTag);
DEBUG_MSG("Dec %p %s: (xfer)", this, oldTag);
#endif
}
inline unsigned GetRefCount () {
return m_ref;
}
inline virtual void OnZeroRef () {
delete this;
}
protected:
inline virtual ~AtomicRef () {
ASSERT(!m_ref);
}
private:
long m_ref;
};
#endif

40
Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp

@ -831,13 +831,13 @@ bool plClothingOutfit::IReadFromVault()
delete sdlDataRec; delete sdlDataRec;
} }
} }
nodes[i]->DecRef(); nodes[i]->UnRef();
} }
fSynchClients = true; // set true if the next synch should be bcast fSynchClients = true; // set true if the next synch should be bcast
ForceUpdate(true); ForceUpdate(true);
rvn->DecRef(); rvn->UnRef();
return true; return true;
} }
@ -874,7 +874,7 @@ void plClothingOutfit::WriteToVault()
SDRs.Add(appearanceStateDesc->GetStateDataRecord(0)); SDRs.Add(appearanceStateDesc->GetStateDataRecord(0));
WriteToVault(SDRs); WriteToVault(SDRs);
rvn->DecRef(); rvn->UnRef();
} }
void plClothingOutfit::WriteToVault(const ARRAY(plStateDataRecord*) & SDRs) void plClothingOutfit::WriteToVault(const ARRAY(plStateDataRecord*) & SDRs)
@ -926,28 +926,28 @@ void plClothingOutfit::WriteToVault(const ARRAY(plStateDataRecord*) & SDRs)
if (nodes.Count()) { if (nodes.Count()) {
node = nodes[0]; node = nodes[0];
nodes.DeleteUnordered(0); nodes.DeleteUnordered(0);
node->IncRef(); // REF: Work node->Ref(); // REF: Work
node->DecRef(); // REF: Find node->UnRef(); // REF: Find
} }
else { else {
RelVaultNode * templateNode = new RelVaultNode; RelVaultNode * templateNode = new RelVaultNode;
templateNode->SetNodeType(plVault::kNodeType_SDL); templateNode->SetNodeType(plVault::kNodeType_SDL);
templates.Add(templateNode); templates.Add(templateNode);
node = templateNode; node = templateNode;
node->IncRef(); // REF: Create node->Ref(); // REF: Create
node->IncRef(); // REF: Work node->Ref(); // REF: Work
} }
VaultSDLNode sdl(node); VaultSDLNode sdl(node);
sdl.SetStateDataRecord((*arr)[i], 0); sdl.SetStateDataRecord((*arr)[i], 0);
node->DecRef(); // REF: Work node->UnRef(); // REF: Work
} }
} }
// Delete any leftover nodes // Delete any leftover nodes
for (unsigned i = 0; i < nodes.Count(); ++i) { for (unsigned i = 0; i < nodes.Count(); ++i) {
VaultDeleteNode(nodes[i]->GetNodeId()); VaultDeleteNode(nodes[i]->GetNodeId());
nodes[i]->DecRef(); // REF: Array nodes[i]->UnRef(); // REF: Array
} }
// Create actual new nodes from their templates // Create actual new nodes from their templates
@ -956,13 +956,13 @@ void plClothingOutfit::WriteToVault(const ARRAY(plStateDataRecord*) & SDRs)
if (RelVaultNode * actual = VaultCreateNodeAndWaitIncRef(templates[i], &result)) { if (RelVaultNode * actual = VaultCreateNodeAndWaitIncRef(templates[i], &result)) {
actuals.Add(actual); actuals.Add(actual);
} }
templates[i]->DecRef(); // REF: Create templates[i]->UnRef(); // REF: Create
} }
// Add new nodes to outfit folder // Add new nodes to outfit folder
for (unsigned i = 0; i < actuals.Count(); ++i) { for (unsigned i = 0; i < actuals.Count(); ++i) {
VaultAddChildNodeAndWait(rvn->GetNodeId(), actuals[i]->GetNodeId(), NetCommGetPlayer()->playerInt); VaultAddChildNodeAndWait(rvn->GetNodeId(), actuals[i]->GetNodeId(), NetCommGetPlayer()->playerInt);
actuals[i]->DecRef(); // REF: Create actuals[i]->UnRef(); // REF: Create
} }
// Cleanup morph SDRs // Cleanup morph SDRs
@ -970,7 +970,7 @@ void plClothingOutfit::WriteToVault(const ARRAY(plStateDataRecord*) & SDRs)
delete morphs[i]; delete morphs[i];
} }
rvn->DecRef(); rvn->UnRef();
} }
// XXX HACK. DON'T USE (this function exists for the temp console command Clothing.SwapClothTexHACK) // XXX HACK. DON'T USE (this function exists for the temp console command Clothing.SwapClothTexHACK)
@ -1489,7 +1489,7 @@ bool plClothingOutfit::WriteToFile(const plFileName &filename)
hsUNIXStream S; hsUNIXStream S;
if (!S.Open(filename, "wb")) { if (!S.Open(filename, "wb")) {
rvn->DecRef(); rvn->UnRef();
return false; return false;
} }
@ -1503,9 +1503,9 @@ bool plClothingOutfit::WriteToFile(const plFileName &filename)
S.WriteLE32(sdl.GetSDLDataLength()); S.WriteLE32(sdl.GetSDLDataLength());
if (sdl.GetSDLDataLength()) if (sdl.GetSDLDataLength())
S.Write(sdl.GetSDLDataLength(), sdl.GetSDLData()); S.Write(sdl.GetSDLDataLength(), sdl.GetSDLData());
nodes[i]->DecRef(); nodes[i]->UnRef();
} }
rvn->DecRef(); rvn->UnRef();
S.Close(); S.Close();
return true; return true;
@ -1652,7 +1652,7 @@ void plClothingMgr::AddItemsToCloset(hsTArray<plClosetItem> &items)
plClothingSDLModifier::PutSingleItemIntoSDR(&items[i], &rec); plClothingSDLModifier::PutSingleItemIntoSDR(&items[i], &rec);
RelVaultNode * templateNode = new RelVaultNode; RelVaultNode * templateNode = new RelVaultNode;
templateNode->IncRef(); templateNode->Ref();
templateNode->SetNodeType(plVault::kNodeType_SDL); templateNode->SetNodeType(plVault::kNodeType_SDL);
VaultSDLNode sdl(templateNode); VaultSDLNode sdl(templateNode);
@ -1669,12 +1669,12 @@ void plClothingMgr::AddItemsToCloset(hsTArray<plClosetItem> &items)
actual->GetNodeId(), actual->GetNodeId(),
NetCommGetPlayer()->playerInt NetCommGetPlayer()->playerInt
); );
actual->DecRef(); // REF: Create actual->UnRef(); // REF: Create
} }
templates[i]->DecRef(); // REF: Create templates[i]->UnRef(); // REF: Create
} }
rvn->DecRef(); rvn->UnRef();
} }
void plClothingMgr::GetClosetItems(hsTArray<plClosetItem> &out) void plClothingMgr::GetClosetItems(hsTArray<plClosetItem> &out)
@ -1702,7 +1702,7 @@ void plClothingMgr::GetClosetItems(hsTArray<plClosetItem> &out)
} }
} }
rvn->DecRef(); rvn->UnRef();
} }
void plClothingMgr::GetAllWithSameMesh(plClothingItem *item, hsTArray<plClothingItem*> &out) void plClothingMgr::GetAllWithSameMesh(plClothingItem *item, hsTArray<plClothingItem*> &out)

2
Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp

@ -865,7 +865,7 @@ void plSceneInputInterface::ILinkOffereeToAge()
VaultRegisterOwnedAgeAndWait(&link); VaultRegisterOwnedAgeAndWait(&link);
} }
} }
linkNode->DecRef(); linkNode->UnRef();
} }
if (!fSpawnPoint.IsEmpty()) { if (!fSpawnPoint.IsEmpty()) {

20
Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp

@ -535,14 +535,14 @@ bool plNetLinkingMgr::IProcessVaultNotifyMsg(plVaultNotifyMsg* msg)
{ {
VaultAgeInfoNode accInfo(rvnInfo); VaultAgeInfoNode accInfo(rvnInfo);
accInfo.CopyTo(cur->GetAgeInfo()); accInfo.CopyTo(cur->GetAgeInfo());
rvnInfo->DecRef(); rvnInfo->UnRef();
} }
IDoLink(fDeferredLink); IDoLink(fDeferredLink);
fDeferredLink = nil; fDeferredLink = nil;
return true; return true;
cVaultLink->DecRef(); cVaultLink->UnRef();
} }
return false; return false;
@ -786,7 +786,7 @@ void plNetLinkingMgr::IPostProcessLink( void )
accInfo.SetAgeInstName(ageInstName); accInfo.SetAgeInstName(ageInstName);
accInfo.SetAgeInstUuid(ageInstGuid); accInfo.SetAgeInstUuid(ageInstGuid);
accInfo.SetOnline(true); accInfo.SetOnline(true);
rvnInfo->DecRef(); rvnInfo->UnRef();
} }
switch (link->GetLinkingRules()) { switch (link->GetLinkingRules()) {
@ -811,9 +811,9 @@ void plNetLinkingMgr::IPostProcessLink( void )
); );
if (fldr) if (fldr)
fldr->DecRef(); fldr->UnRef();
if (info) if (info)
info->DecRef(); info->UnRef();
} }
} }
break; break;
@ -838,9 +838,9 @@ void plNetLinkingMgr::IPostProcessLink( void )
); );
if (fldr) if (fldr)
fldr->DecRef(); fldr->UnRef();
if (info) if (info)
info->DecRef(); info->UnRef();
} }
} }
break; break;
@ -878,7 +878,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void)
accInfo.SetAgeInstName(nil); accInfo.SetAgeInstName(nil);
accInfo.SetAgeInstUuid(kNilUuid); accInfo.SetAgeInstUuid(kNilUuid);
accInfo.SetOnline(false); accInfo.SetOnline(false);
rvnInfo->DecRef(); rvnInfo->UnRef();
} }
#else #else
// Update our online status // Update our online status
@ -890,7 +890,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void)
accInfo.SetAgeInstName(ageInstName); accInfo.SetAgeInstName(ageInstName);
accInfo.SetAgeInstUuid(ageInstGuid); accInfo.SetAgeInstUuid(ageInstGuid);
accInfo.SetOnline(true); accInfo.SetOnline(true);
rvnInfo->DecRef(); rvnInfo->UnRef();
} }
#endif #endif
@ -1035,7 +1035,7 @@ uint8_t plNetLinkingMgr::IPreProcessLink(void)
break; break;
} }
} }
linkNode->DecRef(); linkNode->UnRef();
} }
} }

6
Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp

@ -278,7 +278,7 @@ static void PlayerInitCallback (
if (RelVaultNode * rvn = VaultGetOwnedAgeLinkIncRef(&info)) { if (RelVaultNode * rvn = VaultGetOwnedAgeLinkIncRef(&info)) {
VaultAgeLinkNode acc(rvn); VaultAgeLinkNode acc(rvn);
acc.AddSpawnPoint(plSpawnPointInfo(kCityFerryTerminalLinkTitle, kCityFerryTerminalLinkSpawnPtName)); acc.AddSpawnPoint(plSpawnPointInfo(kCityFerryTerminalLinkTitle, kCityFerryTerminalLinkSpawnPtName));
rvn->DecRef(); rvn->UnRef();
} }
VaultProcessPlayerInbox(); VaultProcessPlayerInbox();
@ -1126,7 +1126,7 @@ void NetCommSetActivePlayer (//--> plNetCommActivePlayerMsg
pInfo.SetOnline(false); pInfo.SetOnline(false);
NetCliAuthVaultNodeSave(rvn, nil, nil); NetCliAuthVaultNodeSave(rvn, nil, nil);
rvn->DecRef(); rvn->UnRef();
} }
VaultCull(s_player->playerInt); VaultCull(s_player->playerInt);
@ -1324,7 +1324,7 @@ void NetCommSetCCRLevel (
if (RelVaultNode * rvnInfo = VaultGetPlayerInfoNodeIncRef()) { if (RelVaultNode * rvnInfo = VaultGetPlayerInfoNodeIncRef()) {
VaultPlayerInfoNode pInfo(rvnInfo); VaultPlayerInfoNode pInfo(rvnInfo);
pInfo.SetCCRLevel(ccrLevel); pInfo.SetCCRLevel(ccrLevel);
rvnInfo->DecRef(); rvnInfo->UnRef();
} }
NetCliAuthSetCCRLevel(ccrLevel); NetCliAuthSetCCRLevel(ccrLevel);

2
Sources/Plasma/PubUtilLib/plNetGameLib/Intern.h

@ -287,7 +287,7 @@ enum ENetTransState {
kTransStateComplete, kTransStateComplete,
}; };
struct NetTrans : AtomicRef { struct NetTrans : hsAtomicRefCnt {
LINK(NetTrans) m_link; LINK(NetTrans) m_link;
ENetTransState m_state; ENetTransState m_state;
ENetError m_result; ENetError m_result;

54
Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp

@ -57,7 +57,7 @@ namespace Ngl { namespace Auth {
* *
***/ ***/
struct CliAuConn : AtomicRef { struct CliAuConn : hsAtomicRefCnt {
CliAuConn (); CliAuConn ();
~CliAuConn (); ~CliAuConn ();
@ -1280,7 +1280,7 @@ static unsigned GetNonZeroTimeMs () {
//============================================================================ //============================================================================
static CliAuConn * GetConnIncRef_CS (const char tag[]) { static CliAuConn * GetConnIncRef_CS (const char tag[]) {
if (CliAuConn * conn = s_active) { if (CliAuConn * conn = s_active) {
conn->IncRef(tag); conn->Ref(tag);
return conn; return conn;
} }
return nil; return nil;
@ -1312,7 +1312,7 @@ static void UnlinkAndAbandonConn_CS (CliAuConn * conn) {
AsyncSocketDisconnect(conn->sock, true); AsyncSocketDisconnect(conn->sock, true);
} }
else { else {
conn->DecRef("Lifetime"); conn->UnRef("Lifetime");
} }
} }
@ -1369,7 +1369,7 @@ static void CheckedReconnect (CliAuConn * conn, ENetError error) {
// Cancel all transactions in progress on this connection. // Cancel all transactions in progress on this connection.
NetTransCancelByConnId(conn->seq, kNetErrTimeout); NetTransCancelByConnId(conn->seq, kNetErrTimeout);
// conn is dead. // conn is dead.
conn->DecRef("Lifetime"); conn->UnRef("Lifetime");
ReportNetError(kNetProtocolCli2Auth, error); ReportNetError(kNetProtocolCli2Auth, error);
} }
else { else {
@ -1405,7 +1405,7 @@ static void NotifyConnSocketConnectFailed (CliAuConn * conn) {
CheckedReconnect(conn, kNetErrConnectFailed); CheckedReconnect(conn, kNetErrConnectFailed);
conn->DecRef("Connecting"); conn->UnRef("Connecting");
} }
//============================================================================ //============================================================================
@ -1426,7 +1426,7 @@ static void NotifyConnSocketDisconnect (CliAuConn * conn) {
CheckedReconnect(conn, kNetErrDisconnected); CheckedReconnect(conn, kNetErrDisconnected);
conn->DecRef("Connected"); conn->UnRef("Connected");
} }
//============================================================================ //============================================================================
@ -1540,7 +1540,7 @@ static void Connect (
conn->lastHeardTimeMs = GetNonZeroTimeMs(); // used in connect timeout, and ping timeout conn->lastHeardTimeMs = GetNonZeroTimeMs(); // used in connect timeout, and ping timeout
strncpy(conn->name, name, arrsize(conn->name)); strncpy(conn->name, name, arrsize(conn->name));
conn->IncRef("Lifetime"); conn->Ref("Lifetime");
conn->AutoReconnect(); conn->AutoReconnect();
} }
@ -1571,7 +1571,7 @@ static void AsyncLookupCallback (
//=========================================================================== //===========================================================================
static unsigned CliAuConnTimerDestroyed (void * param) { static unsigned CliAuConnTimerDestroyed (void * param) {
CliAuConn * conn = (CliAuConn *) param; CliAuConn * conn = (CliAuConn *) param;
conn->DecRef("TimerDestroyed"); conn->UnRef("TimerDestroyed");
return kAsyncTimeInfinite; return kAsyncTimeInfinite;
} }
@ -1617,7 +1617,7 @@ void CliAuConn::TimerReconnect () {
s_critsect.Leave(); s_critsect.Leave();
} }
else { else {
IncRef("Connecting"); Ref("Connecting");
// Remember the time we started the reconnect attempt, guarding against // Remember the time we started the reconnect attempt, guarding against
// TimeGetMs() returning zero (unlikely), as a value of zero indicates // TimeGetMs() returning zero (unlikely), as a value of zero indicates
@ -1656,7 +1656,7 @@ void CliAuConn::StartAutoReconnect () {
void CliAuConn::AutoReconnect () { void CliAuConn::AutoReconnect () {
ASSERT(!reconnectTimer); ASSERT(!reconnectTimer);
IncRef("ReconnectTimer"); Ref("ReconnectTimer");
critsect.Enter(); critsect.Enter();
{ {
AsyncTimerCreate( AsyncTimerCreate(
@ -1690,7 +1690,7 @@ bool CliAuConn::AutoReconnectEnabled () {
//============================================================================ //============================================================================
void CliAuConn::AutoPing () { void CliAuConn::AutoPing () {
ASSERT(!pingTimer); ASSERT(!pingTimer);
IncRef("PingTimer"); Ref("PingTimer");
critsect.Enter(); critsect.Enter();
{ {
AsyncTimerCreate( AsyncTimerCreate(
@ -3941,7 +3941,7 @@ void VaultFetchNodeTrans::Post () {
m_node m_node
); );
if (m_node) if (m_node)
m_node->DecRef("Recv"); m_node->UnRef("Recv");
} }
//============================================================================ //============================================================================
@ -3954,7 +3954,7 @@ bool VaultFetchNodeTrans::Recv (
if (IS_NET_SUCCESS(reply.result)) { if (IS_NET_SUCCESS(reply.result)) {
m_node = new NetVaultNode; m_node = new NetVaultNode;
m_node->Read_LCS(reply.nodeBuffer, reply.nodeBytes, 0); m_node->Read_LCS(reply.nodeBuffer, reply.nodeBytes, 0);
m_node->IncRef("Recv"); m_node->Ref("Recv");
} }
m_result = reply.result; m_result = reply.result;
@ -3980,12 +3980,12 @@ VaultFindNodeTrans::VaultFindNodeTrans (
, m_param(param) , m_param(param)
, m_node(templateNode) , m_node(templateNode)
{ {
m_node->IncRef(); m_node->Ref();
} }
//============================================================================ //============================================================================
VaultFindNodeTrans::~VaultFindNodeTrans () { VaultFindNodeTrans::~VaultFindNodeTrans () {
m_node->DecRef(); m_node->UnRef();
} }
//============================================================================ //============================================================================
@ -4056,7 +4056,7 @@ VaultCreateNodeTrans::VaultCreateNodeTrans (
, m_param(param) , m_param(param)
, m_nodeId(0) , m_nodeId(0)
{ {
m_templateNode->IncRef(); m_templateNode->Ref();
} }
//============================================================================ //============================================================================
@ -4086,7 +4086,7 @@ void VaultCreateNodeTrans::Post () {
m_param, m_param,
m_nodeId m_nodeId
); );
m_templateNode->DecRef(); m_templateNode->UnRef();
} }
//============================================================================ //============================================================================
@ -5024,7 +5024,7 @@ bool NetAuthTrans::AcquireConn () {
//============================================================================ //============================================================================
void NetAuthTrans::ReleaseConn () { void NetAuthTrans::ReleaseConn () {
if (m_conn) { if (m_conn) {
m_conn->DecRef("AcquireConn"); m_conn->UnRef("AcquireConn");
m_conn = nil; m_conn = nil;
} }
} }
@ -5399,7 +5399,7 @@ void NetCliAuthSetCCRLevel (
}; };
conn->Send(msg, arrsize(msg)); conn->Send(msg, arrsize(msg));
conn->DecRef("SetCCRLevel"); conn->UnRef("SetCCRLevel");
} }
//============================================================================ //============================================================================
@ -5433,7 +5433,7 @@ void NetCliAuthSetAgePublic (
conn->Send(msg, arrsize(msg)); conn->Send(msg, arrsize(msg));
conn->DecRef("SetAgePublic"); conn->UnRef("SetAgePublic");
} }
//============================================================================ //============================================================================
@ -5733,7 +5733,7 @@ void NetCliAuthVaultSetSeen (
conn->Send(msg, arrsize(msg)); conn->Send(msg, arrsize(msg));
conn->DecRef("SetSeen"); conn->UnRef("SetSeen");
} }
//============================================================================ //============================================================================
@ -5753,7 +5753,7 @@ void NetCliAuthVaultSendNode (
conn->Send(msg, arrsize(msg)); conn->Send(msg, arrsize(msg));
conn->DecRef("SendNode"); conn->UnRef("SendNode");
} }
//============================================================================ //============================================================================
@ -5817,7 +5817,7 @@ void NetCliAuthPropagateBuffer (
conn->Send(msg, arrsize(msg)); conn->Send(msg, arrsize(msg));
conn->DecRef("PropBuffer"); conn->UnRef("PropBuffer");
} }
@ -5834,7 +5834,7 @@ void NetCliAuthLogPythonTraceback (const wchar_t traceback[]) {
conn->Send(msg, arrsize(msg)); conn->Send(msg, arrsize(msg));
conn->DecRef("LogTraceback"); conn->UnRef("LogTraceback");
} }
@ -5851,7 +5851,7 @@ void NetCliAuthLogStackDump (const wchar_t stackdump[]) {
conn->Send(msg, arrsize(msg)); conn->Send(msg, arrsize(msg));
conn->DecRef("LogStackDump"); conn->UnRef("LogStackDump");
} }
//============================================================================ //============================================================================
@ -5869,7 +5869,7 @@ void NetCliAuthLogClientDebuggerConnect () {
conn->Send(msg, arrsize(msg)); conn->Send(msg, arrsize(msg));
conn->DecRef(); conn->UnRef();
} }
//============================================================================ //============================================================================
@ -5908,7 +5908,7 @@ void NetCliAuthKickPlayer (
}; };
conn->Send(msg, arrsize(msg)); conn->Send(msg, arrsize(msg));
conn->DecRef("KickPlayer"); conn->UnRef("KickPlayer");
} }
//============================================================================ //============================================================================

26
Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.cpp

@ -60,7 +60,7 @@ namespace Ngl { namespace File {
* *
***/ ***/
struct CliFileConn : AtomicRef { struct CliFileConn : hsAtomicRefCnt {
LINK(CliFileConn) link; LINK(CliFileConn) link;
hsReaderWriterLock sockLock; // to protect the socket pointer so we don't nuke it while using it hsReaderWriterLock sockLock; // to protect the socket pointer so we don't nuke it while using it
AsyncSocket sock; AsyncSocket sock;
@ -251,7 +251,7 @@ static unsigned GetNonZeroTimeMs () {
//============================================================================ //============================================================================
static CliFileConn * GetConnIncRef_CS (const char tag[]) { static CliFileConn * GetConnIncRef_CS (const char tag[]) {
if (CliFileConn * conn = s_active) { if (CliFileConn * conn = s_active) {
conn->IncRef(tag); conn->Ref(tag);
return conn; return conn;
} }
return nil; return nil;
@ -291,7 +291,7 @@ static void UnlinkAndAbandonConn_CS (CliFileConn * conn) {
conn->sockLock.UnlockForReading(); conn->sockLock.UnlockForReading();
} }
if (needsDecref) { if (needsDecref) {
conn->DecRef("Lifetime"); conn->UnRef("Lifetime");
} }
} }
@ -346,9 +346,9 @@ static void NotifyConnSocketConnectFailed (CliFileConn * conn) {
if (s_running && conn->AutoReconnectEnabled()) if (s_running && conn->AutoReconnectEnabled())
conn->StartAutoReconnect(); conn->StartAutoReconnect();
else else
conn->DecRef("Lifetime"); // if we are not reconnecting, this socket is done, so remove the lifetime ref conn->UnRef("Lifetime"); // if we are not reconnecting, this socket is done, so remove the lifetime ref
} }
conn->DecRef("Connecting"); conn->UnRef("Connecting");
} }
//============================================================================ //============================================================================
@ -424,10 +424,10 @@ static void NotifyConnSocketDisconnect (CliFileConn * conn) {
if (conn->AutoReconnectEnabled()) if (conn->AutoReconnectEnabled())
conn->StartAutoReconnect(); conn->StartAutoReconnect();
else else
conn->DecRef("Lifetime"); // if we are not reconnecting, this socket is done, so remove the lifetime ref conn->UnRef("Lifetime"); // if we are not reconnecting, this socket is done, so remove the lifetime ref
} }
conn->DecRef("Connected"); conn->UnRef("Connected");
} }
//============================================================================ //============================================================================
@ -552,7 +552,7 @@ static void Connect (
conn->seq = ConnNextSequence(); conn->seq = ConnNextSequence();
conn->lastHeardTimeMs = GetNonZeroTimeMs(); // used in connect timeout, and ping timeout conn->lastHeardTimeMs = GetNonZeroTimeMs(); // used in connect timeout, and ping timeout
conn->IncRef("Lifetime"); conn->Ref("Lifetime");
conn->AutoReconnect(); conn->AutoReconnect();
} }
@ -609,7 +609,7 @@ void CliFileConn::TimerReconnect () {
s_critsect.Leave(); s_critsect.Leave();
} }
else { else {
IncRef("Connecting"); Ref("Connecting");
// Remember the time we started the reconnect attempt, guarding against // Remember the time we started the reconnect attempt, guarding against
// TimeGetMs() returning zero (unlikely), as a value of zero indicates // TimeGetMs() returning zero (unlikely), as a value of zero indicates
@ -654,7 +654,7 @@ void CliFileConn::AutoReconnect () {
timerCritsect.Enter(); timerCritsect.Enter();
{ {
ASSERT(!reconnectTimer); ASSERT(!reconnectTimer);
IncRef("ReconnectTimer"); Ref("ReconnectTimer");
AsyncTimerCreate( AsyncTimerCreate(
&reconnectTimer, &reconnectTimer,
CliFileConnTimerReconnectProc, CliFileConnTimerReconnectProc,
@ -668,7 +668,7 @@ void CliFileConn::AutoReconnect () {
//=========================================================================== //===========================================================================
static unsigned CliFileConnTimerDestroyed (void * param) { static unsigned CliFileConnTimerDestroyed (void * param) {
CliFileConn * sock = (CliFileConn *) param; CliFileConn * sock = (CliFileConn *) param;
sock->DecRef("TimerDestroyed"); sock->UnRef("TimerDestroyed");
return kAsyncTimeInfinite; return kAsyncTimeInfinite;
} }
@ -693,7 +693,7 @@ static unsigned CliFileConnPingTimerProc (void * param) {
//============================================================================ //============================================================================
void CliFileConn::AutoPing () { void CliFileConn::AutoPing () {
ASSERT(!pingTimer); ASSERT(!pingTimer);
IncRef("PingTimer"); Ref("PingTimer");
timerCritsect.Enter(); timerCritsect.Enter();
{ {
sockLock.LockForReading(); sockLock.LockForReading();
@ -1270,7 +1270,7 @@ bool NetFileTrans::AcquireConn () {
//============================================================================ //============================================================================
void NetFileTrans::ReleaseConn () { void NetFileTrans::ReleaseConn () {
if (m_conn) { if (m_conn) {
m_conn->DecRef("AcquireConn"); m_conn->UnRef("AcquireConn");
m_conn = nil; m_conn = nil;
} }
} }

28
Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.cpp

@ -55,7 +55,7 @@ namespace Ngl { namespace Game {
* *
***/ ***/
struct CliGmConn : AtomicRef { struct CliGmConn : hsAtomicRefCnt {
LINK(CliGmConn) link; LINK(CliGmConn) link;
CCritSect critsect; CCritSect critsect;
@ -176,7 +176,7 @@ static unsigned GetNonZeroTimeMs () {
static CliGmConn * GetConnIncRef_CS (const char tag[]) { static CliGmConn * GetConnIncRef_CS (const char tag[]) {
if (CliGmConn * conn = s_active) if (CliGmConn * conn = s_active)
if (conn->cli) { if (conn->cli) {
conn->IncRef(tag); conn->Ref(tag);
return conn; return conn;
} }
return nil; return nil;
@ -205,7 +205,7 @@ static void UnlinkAndAbandonConn_CS (CliGmConn * conn) {
AsyncSocketDisconnect(conn->sock, true); AsyncSocketDisconnect(conn->sock, true);
} }
else { else {
conn->DecRef("Lifetime"); conn->UnRef("Lifetime");
} }
} }
@ -260,8 +260,8 @@ static void NotifyConnSocketConnectFailed (CliGmConn * conn) {
s_critsect.Leave(); s_critsect.Leave();
NetTransCancelByConnId(conn->seq, kNetErrTimeout); NetTransCancelByConnId(conn->seq, kNetErrTimeout);
conn->DecRef("Connecting"); conn->UnRef("Connecting");
conn->DecRef("Lifetime"); conn->UnRef("Lifetime");
if (notify) if (notify)
ReportNetError(kNetProtocolCli2Game, kNetErrConnectFailed); ReportNetError(kNetProtocolCli2Game, kNetErrConnectFailed);
@ -288,8 +288,8 @@ static void NotifyConnSocketDisconnect (CliGmConn * conn) {
// Cancel all transactions in process on this connection. // Cancel all transactions in process on this connection.
NetTransCancelByConnId(conn->seq, kNetErrTimeout); NetTransCancelByConnId(conn->seq, kNetErrTimeout);
conn->DecRef("Connected"); conn->UnRef("Connected");
conn->DecRef("Lifetime"); conn->UnRef("Lifetime");
if (notify) if (notify)
ReportNetError(kNetProtocolCli2Game, kNetErrDisconnected); ReportNetError(kNetProtocolCli2Game, kNetErrDisconnected);
@ -361,8 +361,8 @@ static void Connect (
conn->seq = ConnNextSequence(); conn->seq = ConnNextSequence();
conn->lastHeardTimeMs = GetNonZeroTimeMs(); conn->lastHeardTimeMs = GetNonZeroTimeMs();
conn->IncRef("Lifetime"); conn->Ref("Lifetime");
conn->IncRef("Connecting"); conn->Ref("Connecting");
s_critsect.Enter(); s_critsect.Enter();
{ {
@ -403,7 +403,7 @@ static void Connect (
//=========================================================================== //===========================================================================
static unsigned CliGmConnTimerDestroyed (void * param) { static unsigned CliGmConnTimerDestroyed (void * param) {
CliGmConn * conn = (CliGmConn *) param; CliGmConn * conn = (CliGmConn *) param;
conn->DecRef("TimerDestroyed"); conn->UnRef("TimerDestroyed");
return kAsyncTimeInfinite; return kAsyncTimeInfinite;
} }
@ -431,7 +431,7 @@ CliGmConn::~CliGmConn () {
//============================================================================ //============================================================================
void CliGmConn::AutoPing () { void CliGmConn::AutoPing () {
ASSERT(!pingTimer); ASSERT(!pingTimer);
IncRef("PingTimer"); Ref("PingTimer");
critsect.Enter(); critsect.Enter();
{ {
AsyncTimerCreate( AsyncTimerCreate(
@ -693,7 +693,7 @@ bool NetGameTrans::AcquireConn () {
//============================================================================ //============================================================================
void NetGameTrans::ReleaseConn () { void NetGameTrans::ReleaseConn () {
if (m_conn) { if (m_conn) {
m_conn->DecRef("AcquireConn"); m_conn->UnRef("AcquireConn");
m_conn = nil; m_conn = nil;
} }
} }
@ -860,7 +860,7 @@ void NetCliGamePropagateBuffer (
conn->Send(msg, arrsize(msg)); conn->Send(msg, arrsize(msg));
conn->DecRef("PropBuffer"); conn->UnRef("PropBuffer");
} }
//============================================================================ //============================================================================
@ -882,5 +882,5 @@ void NetCliGameSendGameMgrMsg (GameMsgHeader * msgHdr) {
conn->Send(msg, arrsize(msg)); conn->Send(msg, arrsize(msg));
conn->DecRef("GameMgrMsg"); conn->UnRef("GameMgrMsg");
} }

26
Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp

@ -56,7 +56,7 @@ namespace Ngl { namespace GateKeeper {
* *
***/ ***/
struct CliGkConn : AtomicRef { struct CliGkConn : hsAtomicRefCnt {
CliGkConn (); CliGkConn ();
~CliGkConn (); ~CliGkConn ();
@ -208,7 +208,7 @@ static unsigned GetNonZeroTimeMs () {
//============================================================================ //============================================================================
static CliGkConn * GetConnIncRef_CS (const char tag[]) { static CliGkConn * GetConnIncRef_CS (const char tag[]) {
if (CliGkConn * conn = s_active) { if (CliGkConn * conn = s_active) {
conn->IncRef(tag); conn->Ref(tag);
return conn; return conn;
} }
return nil; return nil;
@ -240,7 +240,7 @@ static void UnlinkAndAbandonConn_CS (CliGkConn * conn) {
AsyncSocketDisconnect(conn->sock, true); AsyncSocketDisconnect(conn->sock, true);
} }
else { else {
conn->DecRef("Lifetime"); conn->UnRef("Lifetime");
} }
} }
@ -303,7 +303,7 @@ static void CheckedReconnect (CliGkConn * conn, ENetError error) {
// Cancel all transactions in progress on this connection. // Cancel all transactions in progress on this connection.
NetTransCancelByConnId(conn->seq, kNetErrTimeout); NetTransCancelByConnId(conn->seq, kNetErrTimeout);
// conn is dead. // conn is dead.
conn->DecRef("Lifetime"); conn->UnRef("Lifetime");
ReportNetError(kNetProtocolCli2GateKeeper, error); ReportNetError(kNetProtocolCli2GateKeeper, error);
} }
else { else {
@ -339,7 +339,7 @@ static void NotifyConnSocketConnectFailed (CliGkConn * conn) {
CheckedReconnect(conn, kNetErrConnectFailed); CheckedReconnect(conn, kNetErrConnectFailed);
conn->DecRef("Connecting"); conn->UnRef("Connecting");
} }
//============================================================================ //============================================================================
@ -359,8 +359,8 @@ static void NotifyConnSocketDisconnect (CliGkConn * conn) {
// Cancel all transactions in process on this connection. // Cancel all transactions in process on this connection.
NetTransCancelByConnId(conn->seq, kNetErrTimeout); NetTransCancelByConnId(conn->seq, kNetErrTimeout);
conn->DecRef("Connected"); conn->UnRef("Connected");
conn->DecRef("Lifetime"); conn->UnRef("Lifetime");
} }
//============================================================================ //============================================================================
@ -474,7 +474,7 @@ static void Connect (
conn->lastHeardTimeMs = GetNonZeroTimeMs(); // used in connect timeout, and ping timeout conn->lastHeardTimeMs = GetNonZeroTimeMs(); // used in connect timeout, and ping timeout
strncpy(conn->name, name, arrsize(conn->name)); strncpy(conn->name, name, arrsize(conn->name));
conn->IncRef("Lifetime"); conn->Ref("Lifetime");
conn->AutoReconnect(); conn->AutoReconnect();
} }
@ -507,7 +507,7 @@ static void AsyncLookupCallback (
//=========================================================================== //===========================================================================
static unsigned CliGkConnTimerDestroyed (void * param) { static unsigned CliGkConnTimerDestroyed (void * param) {
CliGkConn * conn = (CliGkConn *) param; CliGkConn * conn = (CliGkConn *) param;
conn->DecRef("TimerDestroyed"); conn->UnRef("TimerDestroyed");
return kAsyncTimeInfinite; return kAsyncTimeInfinite;
} }
@ -553,7 +553,7 @@ void CliGkConn::TimerReconnect () {
s_critsect.Leave(); s_critsect.Leave();
} }
else { else {
IncRef("Connecting"); Ref("Connecting");
// Remember the time we started the reconnect attempt, guarding against // Remember the time we started the reconnect attempt, guarding against
// TimeGetMs() returning zero (unlikely), as a value of zero indicates // TimeGetMs() returning zero (unlikely), as a value of zero indicates
@ -592,7 +592,7 @@ void CliGkConn::StartAutoReconnect () {
void CliGkConn::AutoReconnect () { void CliGkConn::AutoReconnect () {
ASSERT(!reconnectTimer); ASSERT(!reconnectTimer);
IncRef("ReconnectTimer"); Ref("ReconnectTimer");
critsect.Enter(); critsect.Enter();
{ {
AsyncTimerCreate( AsyncTimerCreate(
@ -626,7 +626,7 @@ bool CliGkConn::AutoReconnectEnabled () {
//============================================================================ //============================================================================
void CliGkConn::AutoPing () { void CliGkConn::AutoPing () {
ASSERT(!pingTimer); ASSERT(!pingTimer);
IncRef("PingTimer"); Ref("PingTimer");
critsect.Enter(); critsect.Enter();
{ {
AsyncTimerCreate( AsyncTimerCreate(
@ -970,7 +970,7 @@ bool NetGateKeeperTrans::AcquireConn () {
//============================================================================ //============================================================================
void NetGateKeeperTrans::ReleaseConn () { void NetGateKeeperTrans::ReleaseConn () {
if (m_conn) { if (m_conn) {
m_conn->DecRef("AcquireConn"); m_conn->UnRef("AcquireConn");
m_conn = nil; m_conn = nil;
} }
} }

10
Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglTrans.cpp

@ -81,7 +81,7 @@ static NetTrans * FindTransIncRef_CS (unsigned transId, const char tag[]) {
// There shouldn't be more than a few transactions; just do a linear scan // There shouldn't be more than a few transactions; just do a linear scan
for (NetTrans * trans = s_transactions.Head(); trans; trans = s_transactions.Next(trans)) for (NetTrans * trans = s_transactions.Head(); trans; trans = s_transactions.Next(trans))
if (trans->m_transId == transId) { if (trans->m_transId == transId) {
trans->IncRef(tag); trans->Ref(tag);
return trans; return trans;
} }
@ -197,7 +197,7 @@ unsigned NetTransGetTimeoutMs () {
//============================================================================ //============================================================================
void NetTransSend (NetTrans * trans) { void NetTransSend (NetTrans * trans) {
trans->IncRef("Lifetime"); trans->Ref("Lifetime");
s_critsect.Enter(); s_critsect.Enter();
{ {
static unsigned s_transId; static unsigned s_transId;
@ -225,7 +225,7 @@ bool NetTransRecv (unsigned transId, const uint8_t msg[], unsigned bytes) {
if (!result) if (!result)
NetTransCancel(transId, kNetErrInternalError); NetTransCancel(transId, kNetErrInternalError);
trans->DecRef("Recv"); trans->UnRef("Recv");
return result; return result;
} }
@ -345,13 +345,13 @@ void NetTransUpdate () {
while (NetTrans * trans = completed.Head()) { while (NetTrans * trans = completed.Head()) {
completed.Unlink(trans); completed.Unlink(trans);
trans->Post(); trans->Post();
trans->DecRef("Lifetime"); trans->UnRef("Lifetime");
} }
// Post completed parent transactions // Post completed parent transactions
while (NetTrans * trans = parentCompleted.Head()) { while (NetTrans * trans = parentCompleted.Head()) {
parentCompleted.Unlink(trans); parentCompleted.Unlink(trans);
trans->Post(); trans->Post();
trans->DecRef("Lifetime"); trans->UnRef("Lifetime");
} }
} }

2
Sources/Plasma/PubUtilLib/plNetMessage/plNetCommonMessage.h

@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// //
// refcntable data // refcntable data
// //
class plNetCommonMessageData : public hsSafeRefCnt class plNetCommonMessageData : public hsAtomicRefCnt
{ {
private: private:
char *fData; // sent char *fData; // sent

420
Sources/Plasma/PubUtilLib/plVault/plVaultClientApi.cpp

File diff suppressed because it is too large Load Diff

4
Sources/Plasma/PubUtilLib/plVault/plVaultNodeAccess.cpp

@ -439,10 +439,10 @@ bool VaultAgeLinkNode::CopyTo (plAgeLinkStruct * link) {
if (RelVaultNode * info = me->GetChildNodeIncRef(plVault::kNodeType_AgeInfo, 1)) { if (RelVaultNode * info = me->GetChildNodeIncRef(plVault::kNodeType_AgeInfo, 1)) {
VaultAgeInfoNode access(info); VaultAgeInfoNode access(info);
access.CopyTo(link->GetAgeInfo()); access.CopyTo(link->GetAgeInfo());
me->DecRef(); me->UnRef();
return true; return true;
} }
me->DecRef(); me->UnRef();
} }
link->Clear(); link->Clear();
return false; return false;

Loading…
Cancel
Save