[Scummvm-cvs-logs] SF.net SVN: scummvm:[46313] scummvm/trunk/graphics
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Wed Dec 9 18:05:24 CET 2009
Revision: 46313
http://scummvm.svn.sourceforge.net/scummvm/?rev=46313&view=rev
Author: lordhoto
Date: 2009-12-09 17:05:23 +0000 (Wed, 09 Dec 2009)
Log Message:
-----------
Cleanup: remove "s_initialized" from CursorManager and FontManager implementation, these classes are Singletons, so they will ever only be initialized once at most anyway.
Modified Paths:
--------------
scummvm/trunk/graphics/cursorman.cpp
scummvm/trunk/graphics/font.h
scummvm/trunk/graphics/fontman.cpp
Modified: scummvm/trunk/graphics/cursorman.cpp
===================================================================
--- scummvm/trunk/graphics/cursorman.cpp 2009-12-09 16:48:33 UTC (rev 46312)
+++ scummvm/trunk/graphics/cursorman.cpp 2009-12-09 17:05:23 UTC (rev 46313)
@@ -31,14 +31,9 @@
namespace Graphics {
-static bool s_initialized = false;
-
CursorManager::CursorManager() {
- if (!s_initialized) {
- s_initialized = true;
- _cursorStack.clear();
- _cursorPaletteStack.clear();
- }
+ _cursorStack.clear();
+ _cursorPaletteStack.clear();
}
bool CursorManager::isVisible() {
Modified: scummvm/trunk/graphics/font.h
===================================================================
--- scummvm/trunk/graphics/font.h 2009-12-09 16:48:33 UTC (rev 46312)
+++ scummvm/trunk/graphics/font.h 2009-12-09 17:05:23 UTC (rev 46313)
@@ -141,7 +141,7 @@
};
#define DEFINE_FONT(n) \
- const NewFont *n; \
+ const NewFont *n = 0; \
void create_##n() { \
n = new NewFont(desc); \
}
Modified: scummvm/trunk/graphics/fontman.cpp
===================================================================
--- scummvm/trunk/graphics/fontman.cpp 2009-12-09 16:48:33 UTC (rev 46312)
+++ scummvm/trunk/graphics/fontman.cpp 2009-12-09 17:05:23 UTC (rev 46313)
@@ -29,30 +29,32 @@
namespace Graphics {
-const ScummFont *g_scummfont;
+const ScummFont *g_scummfont = 0;
extern const NewFont *g_sysfont;
extern const NewFont *g_sysfont_big;
extern const NewFont *g_consolefont;
-static bool s_initialized = false;
-
FontManager::FontManager() {
- if (!s_initialized) {
- // FIXME : this need to be freed
- s_initialized = true;
- g_scummfont = new ScummFont;
- INIT_FONT(g_sysfont)
- INIT_FONT(g_sysfont_big)
- INIT_FONT(g_consolefont)
- }
+ // This assert should *never* trigger, because
+ // FontManager is a singleton, thus there is only
+ // one instance of it per time. (g_scummfont gets
+ // reset to 0 in the desctructor of this class).
+ assert(g_scummfont == 0);
+ g_scummfont = new ScummFont;
+ INIT_FONT(g_sysfont)
+ INIT_FONT(g_sysfont_big)
+ INIT_FONT(g_consolefont)
}
FontManager::~FontManager() {
- s_initialized = false;
delete g_scummfont;
+ g_scummfont = 0;
delete g_sysfont;
+ g_sysfont = 0;
delete g_sysfont_big;
+ g_sysfont_big = 0;
delete g_consolefont;
+ g_consolefont = 0;
}
const Font *FontManager::getFontByName(const Common::String &name) const {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list