Permalink
Browse files

STARTREK: Fix memory leak in drawAllSprites

  • Loading branch information...
Drenn1 authored and sev- committed Jun 25, 2018
1 parent c3bd034 commit aa41f89395b3fa3e74a4e060a06c1dbfd537c158
Showing with 4 additions and 3 deletions.
  1. +1 −1 engines/startrek/awaymission.cpp
  2. +2 −0 engines/startrek/graphics.cpp
  3. +0 −1 engines/startrek/menu.cpp
  4. +1 −1 engines/startrek/text.cpp
@@ -705,7 +705,7 @@ void StarTrekEngine::checkTouchedLoadingZone(int16 x, int16 y) {

/**
* Updates any nonzero away mission timers, and invokes ACTION_TIMER_EXPIRED when any one
* reached 0.
* reaches 0.
*/
void StarTrekEngine::updateAwayMissionTimers() {
for (int i = 0; i < 8; i++) {
@@ -542,6 +542,8 @@ void Graphics::drawAllSprites(bool updateScreen) {
_vm->_system->copyRectToScreen((byte *)surface.getPixels() + offset, SCREEN_WIDTH, r.left, r.top, r.width(), r.height());
}

surface.free();

if (updateScreen) {
// Check if there are any pending updates to the mouse.
if (_mouseBitmap != _mouseBitmapLastFrame) {
@@ -418,7 +418,6 @@ int StarTrekEngine::showActionMenu() {
case Common::KEYCODE_SPACE:
case Common::KEYCODE_F2: // Exit menu without selecting anything
goto exitMenu;
goto exitMenu;

case Common::KEYCODE_RETURN:
case Common::KEYCODE_KP_ENTER:
@@ -207,7 +207,7 @@ String StarTrekEngine::playTextAudio(const String &str) {

/**
* @param rclickCancelsChoice If true, right-clicks return "-1" as choice instead of
* whetever was selected.
* whatever was selected.
*/
int StarTrekEngine::showText(TextGetterFunc textGetter, uintptr var, int xoffset, int yoffset, int textColor, bool loopChoices, int maxTextLines, bool rclickCancelsChoice) {
int16 tmpTextDisplayMode = _textDisplayMode;

0 comments on commit aa41f89

Please sign in to comment.