From 2654135257bc6771a3e18794df15b0d8fc238647 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 23 Jun 2013 11:31:54 -0400 Subject: VOYEUR: Fix crash from using background resource after it's group is freed --- engines/voyeur/animation.cpp | 2 +- engines/voyeur/graphics.cpp | 1 + engines/voyeur/voyeur.cpp | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp index 7b5316b513..1f4e623976 100644 --- a/engines/voyeur/animation.cpp +++ b/engines/voyeur/animation.cpp @@ -329,7 +329,7 @@ RL2Decoder::RL2AudioTrack::~RL2AudioTrack() { void RL2Decoder::RL2AudioTrack::queueSound(Common::SeekableReadStream *stream, int size) { if (_audStream) { // Queue the sound data - byte *data = new byte[size]; + byte *data = (byte *)malloc(size); stream->read(data, size); Common::MemoryReadStream *memoryStream = new Common::MemoryReadStream(data, size, DisposeAfterUse::YES); diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp index 98b3e74087..f517f1afa2 100644 --- a/engines/voyeur/graphics.cpp +++ b/engines/voyeur/graphics.cpp @@ -628,6 +628,7 @@ void GraphicsManager::setColor(int idx, byte r, byte g, byte b) { void GraphicsManager::screenReset() { resetPalette(); + (*_vPort)->setupViewPort(); fillPic(*_vPort, 0); (*_vPort)->_parent->_flags |= DISPFLAG_8; diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp index 75d97aa174..e7adc7d11b 100644 --- a/engines/voyeur/voyeur.cpp +++ b/engines/voyeur/voyeur.cpp @@ -427,10 +427,11 @@ void VoyeurEngine::showTitleScreen() { _graphicsManager.screenReset(); _eventsManager.delay(200); - _bVoy->freeBoltGroup(0x10500); playRL2Video("a1100100.rl2"); _graphicsManager.screenReset(); + + _bVoy->freeBoltGroup(0x10500); } } -- cgit v1.2.3