[Scummvm-cvs-logs] scummvm master -> 5f53b9255eb2799906c324ff0e2ad096092a5dec

m-kiewitz m_kiewitz at users.sourceforge.net
Sun Apr 26 15:30:01 CEST 2015


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:
5f53b9255e SCI: restore: reset ports before loading memory


Commit: 5f53b9255eb2799906c324ff0e2ad096092a5dec
    https://github.com/scummvm/scummvm/commit/5f53b9255eb2799906c324ff0e2ad096092a5dec
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2015-04-26T15:29:02+02:00

Commit Message:
SCI: restore: reset ports before loading memory

otherwise we could free hunk space of the
loaded saved game

Changed paths:
    engines/sci/engine/savegame.cpp



diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index d89170a..e0c2833 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -728,9 +728,7 @@ void GfxPalette::saveLoadWithSerializer(Common::Serializer &s) {
 }
 
 void GfxPorts::saveLoadWithSerializer(Common::Serializer &s) {
-	if (s.isLoading())
-		reset();	// remove all script generated windows
-
+	// reset() is called directly way earlier in gamestate_restore()
 	if (s.getVersion() >= 27) {
 		uint windowCount = 0;
 		uint id = PORTS_FIRSTSCRIPTWINDOWID;
@@ -925,6 +923,13 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
 	// We don't need the thumbnail here, so just read it and discard it
 	Graphics::skipThumbnail(*fh);
 
+	// reset ports as one of the first things we do, because that may free() some hunk memory
+	//  and we don't want to do that after we read in the saved game hunk memory
+	if (ser.isLoading()) {
+		if (g_sci->_gfxPorts)
+			g_sci->_gfxPorts->reset();
+	}
+
 	s->reset(true);
 	s->saveLoadWithSerializer(ser);	// FIXME: Error handling?
 






More information about the Scummvm-git-logs mailing list