Janitor : Release memory to make it easier to detect memory leaks

This commit is contained in:
Magne Sjaastad 2019-11-20 11:48:02 +01:00
parent 0bf782147a
commit 5fc576b8f3
3 changed files with 13 additions and 0 deletions

View File

@ -153,6 +153,9 @@ RiaApplication::RiaApplication()
RiaApplication::~RiaApplication()
{
delete m_preferences;
delete m_project;
RiaFontCache::clear();
}
//--------------------------------------------------------------------------------------------------

View File

@ -129,3 +129,11 @@ RiaFontCache::FontSize RiaFontCache::fontSizeEnumFromPointSize( int pointSize )
}
return closestEnumValue;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaFontCache::clear()
{
ms_fonts.clear();
}

View File

@ -56,6 +56,8 @@ public:
static int pointSizeFromFontSizeEnum( FontSize fontSize );
static FontSize fontSizeEnumFromPointSize( int pointSize );
static void clear();
private:
static std::map<FontSize, cvf::ref<caf::FixedAtlasFont>> ms_fonts;
};