From af1ba4229812b74ea7c543cd14b34be0c9af5db6 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 12 Jan 2010 21:46:50 +0000 Subject: Fix some memory leaks. svn-id: r47284 --- backends/vkeybd/virtual-keyboard-parser.cpp | 7 +++++-- backends/vkeybd/virtual-keyboard.h | 8 +++++++- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'backends/vkeybd') diff --git a/backends/vkeybd/virtual-keyboard-parser.cpp b/backends/vkeybd/virtual-keyboard-parser.cpp index 7af6d2a49f..68e7c7ec75 100644 --- a/backends/vkeybd/virtual-keyboard-parser.cpp +++ b/backends/vkeybd/virtual-keyboard-parser.cpp @@ -154,8 +154,11 @@ bool VirtualKeyboardParser::parserCallback_mode(ParserNode *node) { } else { // remove data relating to old resolution _mode->bitmapName.clear(); - delete _mode->image; - _mode->image = 0; + if (_mode->image) { + _mode->image->free(); + delete _mode->image; + _mode->image = 0; + } _mode->imageMap.removeAllAreas(); _mode->displayArea = Rect(); } diff --git a/backends/vkeybd/virtual-keyboard.h b/backends/vkeybd/virtual-keyboard.h index 2c31afcb35..66f5f8b4ea 100644 --- a/backends/vkeybd/virtual-keyboard.h +++ b/backends/vkeybd/virtual-keyboard.h @@ -121,7 +121,13 @@ protected: OverlayColor displayFontColor; Mode() : image(0) {} - ~Mode() { delete image; } + ~Mode() { + if (image) { + image->free(); + delete image; + image = 0; + } + } }; typedef HashMap ModeMap; -- cgit v1.2.3