Minor improvements to fix for #1713.

This commit is contained in:
hiker 2014-11-27 15:36:56 +11:00
parent 673a9f39c6
commit 6e3c766749
2 changed files with 10 additions and 3 deletions

View File

@ -135,6 +135,15 @@ namespace irr
return ReferenceCounter; return ReferenceCounter;
} }
//! Sets the reference count.
/** Use with extreme caution, since using it incorrectly results in memory
corruption or memory leaks. This method is only implemented for 'hollow'
copies of ScalableFont (an STK extention). */
void setReferenceCount(s32 n)
{
ReferenceCounter = n;
}
//! Returns the debug name of the object. //! Returns the debug name of the object.
/** The Debugname may only be set and changed by the object /** The Debugname may only be set and changed by the object
itself. This method should only be used in Debug mode. itself. This method should only be used in Debug mode.

View File

@ -97,9 +97,7 @@ public:
{ {
ScalableFont* out = new ScalableFont(*this); ScalableFont* out = new ScalableFont(*this);
out->m_is_hollow_copy = true; out->m_is_hollow_copy = true;
//FIXME: test only. Reset the reference counter of the copy to 1 out->setReferenceCount(1);
while (out->getReferenceCount() > 1)
out->drop();
return out; return out;
} }