Core/RefCounted: Remove persistent boolean
Former-commit-id: 99602e0fa1e54b6fc8e0087ef89d0e2c74bcfc15 [formerly 83374368c28b83e4916958e7a58d54ec663a9842] Former-commit-id: 603d0c81eada7d1f25058163bbf97672cd96d08c
This commit is contained in:
@@ -23,13 +23,10 @@ namespace Nz
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief Constructs a RefCounted object with a persistance aspect
|
||||
*
|
||||
* \param persistent if false, object is destroyed when no more referenced
|
||||
* \brief Constructs a RefCounted object
|
||||
*/
|
||||
|
||||
RefCounted::RefCounted(bool persistent) :
|
||||
m_persistent(persistent),
|
||||
RefCounted::RefCounted() :
|
||||
m_referenceCount(0)
|
||||
{
|
||||
}
|
||||
@@ -67,16 +64,6 @@ namespace Nz
|
||||
return m_referenceCount;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Checks whether the object is persistent
|
||||
* \return true if object is not destroyed when no more referenced
|
||||
*/
|
||||
|
||||
bool RefCounted::IsPersistent() const
|
||||
{
|
||||
return m_persistent;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Removes a reference to the object
|
||||
* \return true if object is deleted because no more referenced
|
||||
@@ -94,7 +81,7 @@ namespace Nz
|
||||
}
|
||||
#endif
|
||||
|
||||
if (--m_referenceCount == 0 && !m_persistent)
|
||||
if (--m_referenceCount == 0)
|
||||
{
|
||||
delete this; // Suicide
|
||||
|
||||
@@ -103,26 +90,4 @@ namespace Nz
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Sets the persistence of the object
|
||||
* \return true if object is deleted because no more referenced
|
||||
*
|
||||
* \param persistent Sets the persistence of the object
|
||||
* \param checkReferenceCount Checks if the object should be destroyed if true
|
||||
*/
|
||||
|
||||
bool RefCounted::SetPersistent(bool persistent, bool checkReferenceCount)
|
||||
{
|
||||
m_persistent = persistent;
|
||||
|
||||
if (checkReferenceCount && !persistent && m_referenceCount == 0)
|
||||
{
|
||||
delete this;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user