[Scummvm-cvs-logs] scummvm master -> b7ae6a93a983c7feaa7cf029967354bd176b8efc

DrMcCoy drmccoy at drmccoy.de
Sat Jun 16 17:22:27 CEST 2012


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:
b7ae6a93a9 GOB: Fix a segfault when quitting AJ's World


Commit: b7ae6a93a983c7feaa7cf029967354bd176b8efc
    https://github.com/scummvm/scummvm/commit/b7ae6a93a983c7feaa7cf029967354bd176b8efc
Author: Sven Hesse (drmccoy at users.sourceforge.net)
Date: 2012-06-16T08:20:45-07:00

Commit Message:
GOB: Fix a segfault when quitting AJ's World

Changed paths:
    engines/gob/game.cpp
    engines/gob/game.h
    engines/gob/inter.cpp



diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp
index 502a440..0d19533 100644
--- a/engines/gob/game.cpp
+++ b/engines/gob/game.cpp
@@ -167,6 +167,13 @@ bool Environments::has(Resources *resources, uint8 startEnv, int16 except) const
 	return false;
 }
 
+void Environments::deleted(Variables *variables) {
+	for (uint i = 0; i < kEnvironmentCount; i++) {
+		if (_environments[i].variables == variables)
+			_environments[i].variables = 0;
+	}
+}
+
 bool Environments::clearMedia(uint8 env) {
 	if (env >= kEnvironmentCount)
 		return false;
@@ -947,6 +954,10 @@ void Game::switchTotSub(int16 index, int16 function) {
 	_environments.get(_curEnvironment);
 }
 
+void Game::deletedVars(Variables *variables) {
+	_environments.deleted(variables);
+}
+
 void Game::clearUnusedEnvironment() {
 	if (!_environments.has(_script)) {
 		delete _script;
diff --git a/engines/gob/game.h b/engines/gob/game.h
index b3057ac..995baa5 100644
--- a/engines/gob/game.h
+++ b/engines/gob/game.h
@@ -52,6 +52,8 @@ public:
 	bool has(Script    *script   , uint8 startEnv = 0, int16 except = -1) const;
 	bool has(Resources *resources, uint8 startEnv = 0, int16 except = -1) const;
 
+	void deleted(Variables *variables);
+
 	void clear();
 
 	bool setMedia(uint8 env);
@@ -169,6 +171,8 @@ public:
 	void totSub(int8 flags, const Common::String &totFile);
 	void switchTotSub(int16 index, int16 function);
 
+	void deletedVars(Variables *variables);
+
 	bool loadFunctions(const Common::String &tot, uint16 flags);
 	bool callFunction(const Common::String &tot, const Common::String &function, int16 param);
 
diff --git a/engines/gob/inter.cpp b/engines/gob/inter.cpp
index 843c0bf..4460274 100644
--- a/engines/gob/inter.cpp
+++ b/engines/gob/inter.cpp
@@ -359,6 +359,9 @@ void Inter::allocateVars(uint32 count) {
 }
 
 void Inter::delocateVars() {
+	if (_vm->_game)
+		_vm->_game->deletedVars(_variables);
+
 	delete _variables;
 	_variables = 0;
 }






More information about the Scummvm-git-logs mailing list