[Scummvm-git-logs] scummvm master -> 1b6e2335b39f2296991ad201b78a03d901c5169b
sev-
noreply at scummvm.org
Thu Jun 23 18:26:41 UTC 2022
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:
1b6e2335b3 DIRECTOR: Let Cast class manage registering the archive
Commit: 1b6e2335b39f2296991ad201b78a03d901c5169b
https://github.com/scummvm/scummvm/commit/1b6e2335b39f2296991ad201b78a03d901c5169b
Author: Henrik "Henke37" Andersson (henke at henke37.cjb.net)
Date: 2022-06-23T20:26:37+02:00
Commit Message:
DIRECTOR: Let Cast class manage registering the archive
This fixes a null pointer crash and potential issues when switching between movies.
Changed paths:
engines/director/cast.cpp
engines/director/movie.cpp
diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index 7a6813f05a6..f34a18406e9 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -93,6 +93,9 @@ Cast::~Cast() {
if (_castArchive) {
_castArchive->close();
+
+ g_director->_openResFiles.erase(_castArchive->getPathName());
+
delete _castArchive;
_castArchive = nullptr;
}
@@ -197,6 +200,9 @@ void Cast::setArchive(Archive *archive) {
} else {
_macName = archive->getFileName();
}
+
+ // Register the resfile so that Cursor::readFromResource can find it
+ g_director->_openResFiles.setVal(archive->getPathName(), archive);
}
void Cast::loadArchive() {
diff --git a/engines/director/movie.cpp b/engines/director/movie.cpp
index b1280de7ab0..d023104c31e 100644
--- a/engines/director/movie.cpp
+++ b/engines/director/movie.cpp
@@ -95,9 +95,6 @@ Movie::~Movie() {
// _movieArchive is shared with the cast, so the cast will free it
delete _cast;
- if (_sharedCast)
- g_director->_openResFiles.erase(_sharedCast->getArchive()->getPathName());
-
delete _sharedCast;
delete _score;
}
@@ -284,8 +281,6 @@ void Movie::clearSharedCast() {
if (!_sharedCast)
return;
- g_director->_openResFiles.erase(_sharedCast->getArchive()->getPathName());
-
delete _sharedCast;
_sharedCast = nullptr;
@@ -312,9 +307,6 @@ void Movie::loadSharedCastsFrom(Common::String filename) {
_sharedCast = new Cast(this, 0, true);
_sharedCast->setArchive(sharedCast);
_sharedCast->loadArchive();
-
- // Register the resfile so that Cursor::readFromResource can find it
- g_director->_openResFiles.setVal(sharedCast->getPathName(), sharedCast);
}
CastMember *Movie::getCastMember(CastMemberID memberID) {
More information about the Scummvm-git-logs
mailing list