From 4d49c3db3ae0cce2fe7fa38c65a56c8795e629ac Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 29 Sep 2017 21:16:43 -0400 Subject: TITANIC: Fix leaks in CGameState _movieList --- engines/titanic/game_state.cpp | 8 ++++---- engines/titanic/game_state.h | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index 9bb83cc03a..7de069b97c 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -31,16 +31,16 @@ namespace Titanic { bool CGameStateMovieList::empty() { for (CGameStateMovieList::iterator i = begin(); i != end(); ) { - CMovieListItem *movieItem = *i; + CMovie *movie = *i; - if (movieItem->_item->isActive()) { + if (movie->isActive()) { ++i; } else { i = erase(i); } } - return List::empty(); + return Common::List::empty(); } /*------------------------------------------------------------------------*/ @@ -163,7 +163,7 @@ void CGameState::checkForViewChange() { } void CGameState::addMovie(CMovie *movie) { - _movieList.push_back(new CMovieListItem(movie)); + _movieList.push_back(movie); setMode(GSMODE_CUTSCENE); } diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index 547e8f8221..731e94b792 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -45,13 +45,12 @@ enum Season { SEASON_SPRING = 3 }; -PTR_LIST_ITEM(CMovie); -class CGameStateMovieList : public List { +class CGameStateMovieList : public Common::List { public: CViewItem *_destView; CMovieClip *_movieClip; public: - CGameStateMovieList() : List(), _destView(nullptr), _movieClip(nullptr) {} + CGameStateMovieList() : Common::List(), _destView(nullptr), _movieClip(nullptr) {} /** * Returns true if there are no movies in the list -- cgit v1.2.3