Reordered Reference::SetTo() operation so that it is safe to reinitialize to

the same referenceable.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33215 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2009-09-21 04:29:27 +00:00
parent e4823008da
commit 3bd94918ed

View File

@ -83,10 +83,12 @@ public:
void SetTo(Type* object, bool alreadyHasReference = false)
{
if (object != NULL && !alreadyHasReference)
object->AddReference();
Unset();
fObject = object;
if (fObject && !alreadyHasReference)
fObject->AddReference();
}
void Unset()