[Scummvm-git-logs] scummvm master -> f57287702e4cacc17b655bababf9167783e9e159

dreammaster dreammaster at scummvm.org
Tue Nov 15 03:55:29 CET 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
f57287702e TITANIC: Fix freeing of video surfaces


Commit: f57287702e4cacc17b655bababf9167783e9e159
    https://github.com/scummvm/scummvm/commit/f57287702e4cacc17b655bababf9167783e9e159
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-11-14T21:55:23-05:00

Commit Message:
TITANIC: Fix freeing of video surfaces

Changed paths:
    engines/titanic/support/video_surface.cpp
    engines/titanic/support/video_surface.h
    engines/titanic/titanic.cpp



diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp
index fd570e5..7455e8c 100644
--- a/engines/titanic/support/video_surface.cpp
+++ b/engines/titanic/support/video_surface.cpp
@@ -41,8 +41,6 @@ CVideoSurface::CVideoSurface(CScreenManager *screenManager) :
 }
 
 CVideoSurface::~CVideoSurface() {
-	if (_ddSurface)
-		_videoSurfaceCounter -= freeSurface();
 	--_videoSurfaceCounter;
 
 	if (_freeTransparencySurface == DisposeAfterUse::YES)
@@ -334,6 +332,11 @@ OSVideoSurface::OSVideoSurface(CScreenManager *screenManager, const CResourceKey
 	}
 }
 
+OSVideoSurface::~OSVideoSurface() {
+	if (_ddSurface)
+		_videoSurfaceCounter -= OSVideoSurface::freeSurface();
+}
+
 void OSVideoSurface::loadResource(const CResourceKey &key) {
 	_resourceKey = key;
 	_pendingLoad = true;
diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h
index 690669b..390e70b 100644
--- a/engines/titanic/support/video_surface.h
+++ b/engines/titanic/support/video_surface.h
@@ -356,6 +356,7 @@ class OSVideoSurface : public CVideoSurface {
 public:
 	OSVideoSurface(CScreenManager *screenManager, DirectDrawSurface *surface);
 	OSVideoSurface(CScreenManager *screenManager, const CResourceKey &key, bool flag = false);
+	~OSVideoSurface();
 
 	/**
 	 * Load the surface with the passed resource
diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp
index 29730c3..c6fb0a1 100644
--- a/engines/titanic/titanic.cpp
+++ b/engines/titanic/titanic.cpp
@@ -71,10 +71,10 @@ TitanicEngine::TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDe
 TitanicEngine::~TitanicEngine() {
 	delete _debugger;
 	delete _events;
-	delete _screen;
 	delete _window;
 	delete _screenManager;
 	delete _filesManager;
+	delete _screen;
 	CSaveableObject::freeClassList();
 }
 





More information about the Scummvm-git-logs mailing list