diff options
author | Stephen Kennedy | 2008-08-14 19:20:25 +0000 |
---|---|---|
committer | Stephen Kennedy | 2008-08-14 19:20:25 +0000 |
commit | 08ef79ce45b2e525b67989b858a8652b3f7ed849 (patch) | |
tree | a3c92187b24e79ecacab054f1069bdd191f3713a /backends | |
parent | d40e7a6640a3e58e62f75dc9c05e41fbaaa26bd4 (diff) | |
download | scummvm-rg350-08ef79ce45b2e525b67989b858a8652b3f7ed849.tar.gz scummvm-rg350-08ef79ce45b2e525b67989b858a8652b3f7ed849.tar.bz2 scummvm-rg350-08ef79ce45b2e525b67989b858a8652b3f7ed849.zip |
Loads of valgrind fixes
svn-id: r33869
Diffstat (limited to 'backends')
-rw-r--r-- | backends/keymapper/keymap.cpp | 6 | ||||
-rw-r--r-- | backends/keymapper/keymap.h | 1 | ||||
-rw-r--r-- | backends/keymapper/remap-dialog.cpp | 4 | ||||
-rw-r--r-- | backends/vkeybd/virtual-keyboard-gui.cpp | 38 | ||||
-rw-r--r-- | backends/vkeybd/virtual-keyboard-gui.h | 2 | ||||
-rw-r--r-- | backends/vkeybd/virtual-keyboard.cpp | 2 |
6 files changed, 33 insertions, 20 deletions
diff --git a/backends/keymapper/keymap.cpp b/backends/keymapper/keymap.cpp index 64076d4457..42454efc87 100644 --- a/backends/keymapper/keymap.cpp +++ b/backends/keymapper/keymap.cpp @@ -38,6 +38,12 @@ Keymap::Keymap(const Keymap& km) : _actions(km._actions), _keymap(), _configDoma } } +Keymap::~Keymap() { + List<Action*>::iterator it; + for (it = _actions.begin(); it != _actions.end(); it++) + delete *it; +} + void Keymap::addAction(Action *action) { if (findAction(action->id)) error("Action with id %d already in KeyMap!", action->id); diff --git a/backends/keymapper/keymap.h b/backends/keymapper/keymap.h index 3159dab7f8..f921b5bd87 100644 --- a/backends/keymapper/keymap.h +++ b/backends/keymapper/keymap.h @@ -53,6 +53,7 @@ class Keymap { public: Keymap(const String& name, Keymap *parent = 0) : _name(name), _parent(parent) {} Keymap(const Keymap& km); + ~Keymap(); public: /** diff --git a/backends/keymapper/remap-dialog.cpp b/backends/keymapper/remap-dialog.cpp index 57e4578629..0c9d29a7a1 100644 --- a/backends/keymapper/remap-dialog.cpp +++ b/backends/keymapper/remap-dialog.cpp @@ -265,9 +265,7 @@ void RemapDialog::loadKeymap() { } } else if (_kmPopUp->getSelected() != -1) { - uint32 select = _kmPopUp->getSelected(); - uint32 tag = _kmPopUp->getSelectedTag(); - Keymap *km = _keymapTable[tag]; + Keymap *km = _keymapTable[_kmPopUp->getSelectedTag()]; List<Action*>::iterator it; for (it = km->getActions().begin(); it != km->getActions().end(); it++) { diff --git a/backends/vkeybd/virtual-keyboard-gui.cpp b/backends/vkeybd/virtual-keyboard-gui.cpp index cbdf11e083..7ef07735f7 100644 --- a/backends/vkeybd/virtual-keyboard-gui.cpp +++ b/backends/vkeybd/virtual-keyboard-gui.cpp @@ -29,20 +29,23 @@ namespace Common { -VirtualKeyboardGUI::VirtualKeyboardGUI(VirtualKeyboard *kbd) { - _kbd = kbd; - +VirtualKeyboardGUI::VirtualKeyboardGUI(VirtualKeyboard *kbd) + : _kbd(kbd), _displaying(false), _needRedraw(false), _drag(false), + _drawCaret(false), _refreshDisplay(false), _displayEnabled(false), + _firstRun(true), _cursorAnimateTimer(0), _cursorAnimateCounter(0) { + + assert(_kbd); assert(g_system); _system = g_system; - + _lastScreenChanged = _system->getScreenChangeID(); - + memset(_cursor, 0xFF, sizeof(_cursor)); +} - _displaying = _needRedraw = _drag = _drawCaret = _displayEnabled = false; - _firstRun = true; - - _cursorAnimateTimer = 0; +VirtualKeyboardGUI::~VirtualKeyboardGUI() { + _overlayBackup.free(); + _dispSurface.free(); } void VirtualKeyboardGUI::initMode(VirtualKeyboard::Mode *mode) { @@ -52,6 +55,7 @@ void VirtualKeyboardGUI::initMode(VirtualKeyboard::Mode *mode) { _kbdBound.setHeight(_kbdSurface->h + 1); _needRedraw = true; + _dispSurface.free(); _displayEnabled = false; if (!mode->displayArea) return; @@ -66,7 +70,6 @@ void VirtualKeyboardGUI::initMode(VirtualKeyboard::Mode *mode) { } _dispX = r.left; _dispY = r.top + (r.height() + 1 - _dispFont->getFontHeight()) / 2; - _dispSurface.free(); _dispSurface.create(r.width() + 1, _dispFont->getFontHeight(), sizeof(OverlayColor)); _dispI = 0; _dispForeColor = mode->displayFontColor; @@ -108,6 +111,7 @@ void VirtualKeyboardGUI::run() { if (!g_gui.isActive()) _system->hideOverlay(); _overlayBackup.free(); + _dispSurface.free(); } void VirtualKeyboardGUI::hide() { @@ -192,7 +196,7 @@ void VirtualKeyboardGUI::mainLoop() { if (_kbd->_keyQueue.hasStringChanged()) _refreshDisplay = true; animateCaret(); - if (_refreshDisplay) updateDisplay();; + if (_refreshDisplay) updateDisplay(); } if (_needRedraw) redraw(); animateCursor(); @@ -261,16 +265,16 @@ void VirtualKeyboardGUI::redraw() { extendDirtyRect(_kbdBound); Graphics::SurfaceKeyColored surf; - surf.create(_dirtyRect.width()+1, _dirtyRect.height()+1, sizeof(OverlayColor)); + surf.create(_dirtyRect.width(), _dirtyRect.height(), sizeof(OverlayColor)); - OverlayColor *scr = (OverlayColor *)surf.pixels; - const OverlayColor *ove = (OverlayColor *) _overlayBackup.getBasePtr(_dirtyRect.left, _dirtyRect.top); + OverlayColor *dst = (OverlayColor *)surf.pixels; + const OverlayColor *src = (OverlayColor *) _overlayBackup.getBasePtr(_dirtyRect.left, _dirtyRect.top); int16 h = surf.h; while (h--) { - memcpy(scr, ove, surf.w * sizeof(OverlayColor)); - scr += surf.w; - ove += _overlayBackup.w; + memcpy(dst, src, surf.w * sizeof(OverlayColor)); + dst += surf.w; + src += _overlayBackup.w; } int16 keyX = _kbdBound.left - _dirtyRect.left; diff --git a/backends/vkeybd/virtual-keyboard-gui.h b/backends/vkeybd/virtual-keyboard-gui.h index 5836859262..ba3025f3b6 100644 --- a/backends/vkeybd/virtual-keyboard-gui.h +++ b/backends/vkeybd/virtual-keyboard-gui.h @@ -39,6 +39,8 @@ class VirtualKeyboardGUI { public: VirtualKeyboardGUI(VirtualKeyboard *kbd); + ~VirtualKeyboardGUI(); + void initMode(VirtualKeyboard::Mode *mode); void run(); void hide(); diff --git a/backends/vkeybd/virtual-keyboard.cpp b/backends/vkeybd/virtual-keyboard.cpp index ae0fd86ee5..67bae7783f 100644 --- a/backends/vkeybd/virtual-keyboard.cpp +++ b/backends/vkeybd/virtual-keyboard.cpp @@ -214,6 +214,8 @@ bool VirtualKeyboard::isDisplaying() { VirtualKeyboard::KeyPressQueue::KeyPressQueue() { _keyPos = _keys.end(); _strPos = 0; + _strChanged = false; + _keyFlags = 0; } void VirtualKeyboard::KeyPressQueue::toggleFlags(byte fl) { |