Skip to content

Commit

Permalink
BASE: Free TTFLibrary singleton on shutdown.
Browse files Browse the repository at this point in the history
This uses a helper function because TTFLibrary is internal.
  • Loading branch information
fuzzie committed Mar 28, 2012
1 parent 6d3927c commit b470c9a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions base/main.cpp
Expand Up @@ -57,6 +57,9 @@

#include "graphics/cursorman.h"
#include "graphics/fontman.h"
#ifdef USE_FREETYPE2
#include "graphics/fonts/ttf.h"
#endif

#include "backends/keymapper/keymapper.h"

Expand Down Expand Up @@ -505,6 +508,9 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
MusicManager::destroy();
Graphics::CursorManager::destroy();
Graphics::FontManager::destroy();
#ifdef USE_FREETYPE2
Graphics::shutdownTTF();
#endif

return 0;
}
4 changes: 4 additions & 0 deletions graphics/fonts/ttf.cpp
Expand Up @@ -70,6 +70,10 @@ class TTFLibrary : public Common::Singleton<TTFLibrary> {
bool _initialized;
};

void shutdownTTF() {
TTFLibrary::destroy();
}

#define g_ttf ::Graphics::TTFLibrary::instance()

TTFLibrary::TTFLibrary() : _library(), _initialized(false) {
Expand Down
2 changes: 2 additions & 0 deletions graphics/fonts/ttf.h
Expand Up @@ -34,6 +34,8 @@ namespace Graphics {
class Font;
Font *loadTTFFont(Common::SeekableReadStream &stream, int size, bool monochrome = false, const uint32 *mapping = 0);

void shutdownTTF();

} // End of namespace Graphics

#endif
Expand Down

0 comments on commit b470c9a

Please sign in to comment.