diff --git a/lib/irrlicht/include/IReferenceCounted.h b/lib/irrlicht/include/IReferenceCounted.h index 8a551e8c4..35a2ccb3e 100644 --- a/lib/irrlicht/include/IReferenceCounted.h +++ b/lib/irrlicht/include/IReferenceCounted.h @@ -135,6 +135,15 @@ namespace irr 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. /** The Debugname may only be set and changed by the object itself. This method should only be used in Debug mode. diff --git a/src/guiengine/scalable_font.hpp b/src/guiengine/scalable_font.hpp index d186fec23..612536a99 100644 --- a/src/guiengine/scalable_font.hpp +++ b/src/guiengine/scalable_font.hpp @@ -97,9 +97,7 @@ public: { ScalableFont* out = new ScalableFont(*this); out->m_is_hollow_copy = true; - //FIXME: test only. Reset the reference counter of the copy to 1 - while (out->getReferenceCount() > 1) - out->drop(); + out->setReferenceCount(1); return out; }