aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/vkeybd/virtual-keyboard-parser.cpp7
-rw-r--r--backends/vkeybd/virtual-keyboard.h8
2 files changed, 12 insertions, 3 deletions
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<String, Mode, IgnoreCase_Hash, IgnoreCase_EqualTo> ModeMap;