diff options
author | Martin Kiewitz | 2010-01-12 18:43:10 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-01-12 18:43:10 +0000 |
commit | a14f044daa9210c55431a9683610064fa3594054 (patch) | |
tree | 026a328179d6a0c342b9816530eb6823fcda5391 /engines | |
parent | 73bacd5d3a1b9a4c4646313c7efb8c81a185de73 (diff) | |
download | scummvm-rg350-a14f044daa9210c55431a9683610064fa3594054.tar.gz scummvm-rg350-a14f044daa9210c55431a9683610064fa3594054.tar.bz2 scummvm-rg350-a14f044daa9210c55431a9683610064fa3594054.zip |
SCI: deleting _font when changing active font
svn-id: r47269
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/graphics/text.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/engines/sci/graphics/text.cpp b/engines/sci/graphics/text.cpp index c0bb8d8e00..a65bd36339 100644 --- a/engines/sci/graphics/text.cpp +++ b/engines/sci/graphics/text.cpp @@ -41,7 +41,8 @@ Text::Text(ResourceManager *resMan, Gfx *gfx, Screen *screen) } Text::~Text() { - delete _font; + if (_font != NULL) + delete _font; } void Text::init() { @@ -57,15 +58,21 @@ GuiResourceId Text::GetFontId() { } Font *Text::GetFont() { - if ((_font == NULL) || (_font->getResourceId() != _gfx->_curPort->fontId)) + if ((_font == NULL) || (_font->getResourceId() != _gfx->_curPort->fontId)) { + if (_font != NULL) + delete _font; _font = new Font(_resMan, _gfx->_curPort->fontId); + } return _font; } void Text::SetFont(GuiResourceId fontId) { - if ((_font == NULL) || (_font->getResourceId() != fontId)) + if ((_font == NULL) || (_font->getResourceId() != fontId)) { + if (_font != NULL) + delete _font; _font = new Font(_resMan, fontId); + } _gfx->_curPort->fontId = _font->getResourceId(); _gfx->_curPort->fontHeight = _font->getHeight(); |