[Scummvm-cvs-logs] SF.net SVN: scummvm:[47269] scummvm/trunk/engines/sci/graphics/text.cpp

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Tue Jan 12 19:43:10 CET 2010


Revision: 47269
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47269&view=rev
Author:   m_kiewitz
Date:     2010-01-12 18:43:10 +0000 (Tue, 12 Jan 2010)

Log Message:
-----------
SCI: deleting _font when changing active font

Modified Paths:
--------------
    scummvm/trunk/engines/sci/graphics/text.cpp

Modified: scummvm/trunk/engines/sci/graphics/text.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/text.cpp	2010-01-12 18:40:43 UTC (rev 47268)
+++ scummvm/trunk/engines/sci/graphics/text.cpp	2010-01-12 18:43:10 UTC (rev 47269)
@@ -41,7 +41,8 @@
 }
 
 Text::~Text() {
-	delete _font;
+	if (_font != NULL)
+		delete _font;
 }
 
 void Text::init() {
@@ -57,15 +58,21 @@
 }
 
 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();


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