aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-07-30 20:39:04 +0200
committerEinar Johan Trøan Sømåen2012-07-30 20:39:04 +0200
commit6330c1e5fdced523e1e245eac67754cd2b519c32 (patch)
tree9257bd4ef4b891759839f0082be2e9087ae00903 /engines/wintermute
parent18409fe5c03264ca74902e263f80523692f76a77 (diff)
downloadscummvm-rg350-6330c1e5fdced523e1e245eac67754cd2b519c32.tar.gz
scummvm-rg350-6330c1e5fdced523e1e245eac67754cd2b519c32.tar.bz2
scummvm-rg350-6330c1e5fdced523e1e245eac67754cd2b519c32.zip
WINTERMUTE: Fix a few memory-leaks
Diffstat (limited to 'engines/wintermute')
-rw-r--r--engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp2
-rw-r--r--engines/wintermute/video/video_theora_player.cpp5
-rw-r--r--engines/wintermute/wintermute.cpp1
3 files changed, 8 insertions, 0 deletions
diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
index c449f6471c..9f0e605f39 100644
--- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
+++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
@@ -139,6 +139,7 @@ bool BaseSurfaceOSystem::finishLoad() {
// convert 32-bit BMPs to 24-bit or they appear totally transparent (does any app actually write alpha in BMP properly?)
// Well, actually, we don't convert via 24-bit as the color-key application overwrites the Alpha-channel anyhow.
+ _surface->free();
delete _surface;
if (_filename.hasSuffix(".bmp") && image->getSurface()->format.bytesPerPixel == 4) {
_surface = image->getSurface()->convertTo(g_system->getScreenFormat(), image->getPalette());
@@ -412,6 +413,7 @@ bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, float zoomX, flo
bool BaseSurfaceOSystem::putSurface(const Graphics::Surface &surface, bool hasAlpha) {
_loaded = true;
+ _surface->free();
_surface->copyFrom(surface);
_hasAlpha = hasAlpha;
BaseRenderOSystem *renderer = static_cast<BaseRenderOSystem *>(_gameRef->_renderer);
diff --git a/engines/wintermute/video/video_theora_player.cpp b/engines/wintermute/video/video_theora_player.cpp
index 49ce333b63..fea81bdf9d 100644
--- a/engines/wintermute/video/video_theora_player.cpp
+++ b/engines/wintermute/video/video_theora_player.cpp
@@ -109,6 +109,9 @@ void VideoTheoraPlayer::cleanup() {
}
_surface.free();
+ if (_theoraDecoder) {
+ _theoraDecoder->close();
+ }
delete _theoraDecoder;
_theoraDecoder = NULL;
delete _alphaImage;
@@ -187,6 +190,7 @@ bool VideoTheoraPlayer::play(TVideoPlayback type, int x, int y, bool freezeGame,
_playbackStarted = false;
float width, height;
if (_theoraDecoder) {
+ _surface.free();
_surface.copyFrom(*_theoraDecoder->decodeNextFrame());
_state = THEORA_STATE_PLAYING;
_looping = looping;
@@ -277,6 +281,7 @@ bool VideoTheoraPlayer::update() {
}
if (_state == THEORA_STATE_PLAYING) {
if (_theoraDecoder->getTimeToNextFrame() == 0) {
+ _surface.free();
_surface.copyFrom(*_theoraDecoder->decodeNextFrame());
if (_texture) {
writeVideo();
diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp
index af0251d01a..80b02f7db6 100644
--- a/engines/wintermute/wintermute.cpp
+++ b/engines/wintermute/wintermute.cpp
@@ -88,6 +88,7 @@ WinterMuteEngine::~WinterMuteEngine() {
deinit();
delete _rnd;
delete _game;
+ delete _console;
g_wintermute = NULL;
// Remove all of our debug levels here