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

dreammaster dreammaster at scummvm.org
Wed Nov 16 03:04:38 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:
afb4b6227a TITANIC: Fixes for freeing project and engine objects on exit


Commit: afb4b6227a0f20ca829801e00dcf75eeb4c18999
    https://github.com/scummvm/scummvm/commit/afb4b6227a0f20ca829801e00dcf75eeb4c18999
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-11-15T21:04:30-05:00

Commit Message:
TITANIC: Fixes for freeing project and engine objects on exit

Changed paths:
    engines/titanic/core/project_item.h
    engines/titanic/main_game_window.cpp
    engines/titanic/support/movie.cpp
    engines/titanic/titanic.cpp



diff --git a/engines/titanic/core/project_item.h b/engines/titanic/core/project_item.h
index 20c4a43..14ca3fd 100644
--- a/engines/titanic/core/project_item.h
+++ b/engines/titanic/core/project_item.h
@@ -152,6 +152,7 @@ public:
 public:
 	CLASSDEF;
 	CProjectItem();
+	virtual ~CProjectItem() { destroyChildren(); }
 
 	/**
 	 * Save the data for the class to file
diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp
index de0ac71..1024589 100644
--- a/engines/titanic/main_game_window.cpp
+++ b/engines/titanic/main_game_window.cpp
@@ -46,6 +46,7 @@ CMainGameWindow::CMainGameWindow(TitanicEngine *vm): _vm(vm),
 }
 
 CMainGameWindow::~CMainGameWindow() {
+	delete _project;
 }
 
 void CMainGameWindow::applicationStarting() {
diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp
index 1bdcdee..c26e4eb 100644
--- a/engines/titanic/support/movie.cpp
+++ b/engines/titanic/support/movie.cpp
@@ -50,15 +50,9 @@ void CMovie::init() {
 }
 
 void CMovie::deinit() {
-	// Delete each movie in turn
-	for (CMovieList::iterator i = _playingMovies->begin(); i != _playingMovies->end(); ) {
-		// We need to increment iterator before deleting movie,
-		// since the CMovie destructor calls removeFromPlayingMovies
-		CMovie *movie = *i;
-		++i;
-		delete movie;
-	}
-
+	// At this point, there shouldn't be any playing movies left,
+	// since their owning objects should have freed them
+	assert(_playingMovies->empty());
 	delete _playingMovies;
 	delete _movieSurface;
 }
diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp
index c6fb0a1..e80dc54 100644
--- a/engines/titanic/titanic.cpp
+++ b/engines/titanic/titanic.cpp
@@ -69,13 +69,6 @@ TitanicEngine::TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDe
 }
 
 TitanicEngine::~TitanicEngine() {
-	delete _debugger;
-	delete _events;
-	delete _window;
-	delete _screenManager;
-	delete _filesManager;
-	delete _screen;
-	CSaveableObject::freeClassList();
 }
 
 void TitanicEngine::initializePath(const Common::FSNode &gamePath) {
@@ -116,10 +109,16 @@ void TitanicEngine::initialize() {
 }
 
 void TitanicEngine::deinitialize() {
+	delete _debugger;
+	delete _events;
+	delete _window;
+	delete _screenManager;
+	delete _filesManager;
+	delete _screen;
+
 	CEnterExitFirstClassState::deinit();
 	CGetLiftEye2::deinit();
 	CHose::deinit();
-	CMovie::deinit();
 	CSGTNavigation::deinit();
 	CSGTStateRoom::deinit();
 	CExitPellerator::deinit();
@@ -127,6 +126,8 @@ void TitanicEngine::deinitialize() {
 	CGameObject::deinit();
 	CTelevision::deinit();
 	TTnpcScript::deinit();
+	CMovie::deinit();
+	CSaveableObject::freeClassList();
 }
 
 Common::Error TitanicEngine::run() {





More information about the Scummvm-git-logs mailing list