aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2004-08-25 05:57:17 +0000
committerTorbjörn Andersson2004-08-25 05:57:17 +0000
commit137d1ebe486c0fc76dd9ebeeabdf3e815e8b7a8b (patch)
tree035ce88efd923b1370ccb758ab6272a3ef903ae4
parent7aa9f41188560b58fe30f5df4abf0681fba8f848 (diff)
downloadscummvm-rg350-137d1ebe486c0fc76dd9ebeeabdf3e815e8b7a8b.tar.gz
scummvm-rg350-137d1ebe486c0fc76dd9ebeeabdf3e815e8b7a8b.tar.bz2
scummvm-rg350-137d1ebe486c0fc76dd9ebeeabdf3e815e8b7a8b.zip
Added a destructor to the FontRenderer class to free any remaining text
sprites on exit. As far as I can tell, the only case when this makes any difference is when there is text on screen when you quit ScummVM, so it's not really a memory leak, but Valgrind will report it as one. svn-id: r14738
-rw-r--r--sword2/maketext.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/sword2/maketext.h b/sword2/maketext.h
index adde69d9cd..4cc1785e2f 100644
--- a/sword2/maketext.h
+++ b/sword2/maketext.h
@@ -99,6 +99,11 @@ public:
_blocList[i].text_mem = NULL;
}
+ ~FontRenderer() {
+ for (int i = 0; i < MAX_text_blocs; i++)
+ free(_blocList[i].text_mem);
+ }
+
byte *makeTextSprite(byte *sentence, uint16 maxWidth, uint8 pen, uint32 fontRes, uint8 border = BORDER_PEN);
void killTextBloc(uint32 bloc_number);