[Scummvm-git-logs] scummvm master -> 3525d5d4c9d7a329725172e5860b9ea2c0dde085

dreammaster dreammaster at scummvm.org
Wed Jul 19 04:10:03 CEST 2017


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:
3525d5d4c9 TITANIC: Fix crash trying to restart game after returning to launcher


Commit: 3525d5d4c9d7a329725172e5860b9ea2c0dde085
    https://github.com/scummvm/scummvm/commit/3525d5d4c9d7a329725172e5860b9ea2c0dde085
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-07-18T22:09:57-04:00

Commit Message:
TITANIC: Fix crash trying to restart game after returning to launcher

Changed paths:
    engines/titanic/core/message_target.cpp
    engines/titanic/core/message_target.h
    engines/titanic/core/saveable_object.cpp
    engines/titanic/messages/messages.cpp


diff --git a/engines/titanic/core/message_target.cpp b/engines/titanic/core/message_target.cpp
index a1060c6..e471bc6 100644
--- a/engines/titanic/core/message_target.cpp
+++ b/engines/titanic/core/message_target.cpp
@@ -29,8 +29,9 @@ const MSGMAP *CMessageTarget::getMessageMap() const {
 }
 
 const MSGMAP *CMessageTarget::getThisMessageMap() {
+	static const ClassDef *nullDef = nullptr;
 	static const MSGMAP_ENTRY _messageEntries[] = {
-		{ (PMSG)nullptr, nullptr }
+		{ (PMSG)nullptr, &nullDef }
 	};
 
 	static const MSGMAP messageMap = { nullptr, &_messageEntries[0] };
diff --git a/engines/titanic/core/message_target.h b/engines/titanic/core/message_target.h
index a382b63..a09e6e3 100644
--- a/engines/titanic/core/message_target.h
+++ b/engines/titanic/core/message_target.h
@@ -34,7 +34,7 @@ typedef bool (CMessageTarget::*PMSG)(CMessage *msg);
 
 struct MSGMAP_ENTRY {
 	PMSG _fn;
-	ClassDef *_class;
+	const ClassDef * const *_class;
 };
 
 struct MSGMAP {
@@ -58,7 +58,7 @@ protected: \
 		static const MSGMAP_ENTRY _messageEntries[] = {
 
 #define ON_MESSAGE(msgClass) \
-	{ static_cast<PMSG>((FNPTR)&ThisClass::msgClass), C##msgClass::_type },
+	{ static_cast<PMSG>((FNPTR)&ThisClass::msgClass), &C##msgClass::_type },
 
 #define END_MESSAGE_MAP() \
 		{ (PMSG)nullptr, nullptr } \
diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp
index 0257f6a..4784151 100644
--- a/engines/titanic/core/saveable_object.cpp
+++ b/engines/titanic/core/saveable_object.cpp
@@ -1024,9 +1024,12 @@ void CSaveableObject::initClassList() {
 	_classDefs = new ClassDefList();
 	_classList = new ClassListMap();
 
+	CSaveableObject::_type = new TypeTemplate<CSaveableObject>("CSaveableObject", nullptr);
+	_classDefs->push_back(CSaveableObject::_type);
+	(*_classList)["CSaveableObject"] = FunctionCSaveableObject;
+
 	// Setup the type definitions for each class. Note that these have to be
 	// in order of hierarchy from ancestor class to descendent
-	ADDFN(CSaveableObject, CSaveableObject);
 	ADDFN(CMessage, CSaveableObject);
 	ADDFN(CMessageTarget, CSaveableObject);
 	ADDFN(CResourceKey, CSaveableObject);
diff --git a/engines/titanic/messages/messages.cpp b/engines/titanic/messages/messages.cpp
index db89c3d..331d580 100644
--- a/engines/titanic/messages/messages.cpp
+++ b/engines/titanic/messages/messages.cpp
@@ -89,7 +89,8 @@ const MSGMAP_ENTRY *CMessage::findMapEntry(const CTreeItem *treeItem, const Clas
 		for (const MSGMAP_ENTRY *entry = msgMap->lpEntries;
 				entry->_class != nullptr; ++entry) {
 			// Check if the class or any of it's ancesotrs is handled by this entry
-			for (const ClassDef *entryDef = entry->_class; entryDef; entryDef = entryDef->_parent) {
+			for (const ClassDef *entryDef = *entry->_class; entryDef;
+					entryDef = entryDef->_parent) {
 				if (entryDef == classDef)
 					return entry;
 			}





More information about the Scummvm-git-logs mailing list