[Scummvm-git-logs] scummvm master -> dd6e641f9ccbb410548ab37786a73cdd912041ed

fracturehill noreply at scummvm.org
Sun Jul 21 21:06:09 UTC 2024


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:
dd6e641f9c NANCY: Fix crash loading scene with PuzzleData


Commit: dd6e641f9ccbb410548ab37786a73cdd912041ed
    https://github.com/scummvm/scummvm/commit/dd6e641f9ccbb410548ab37786a73cdd912041ed
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2024-07-21T23:05:55+02:00

Commit Message:
NANCY: Fix crash loading scene with PuzzleData

A scene that contains one of the puzzles that have an
associated PuzzleData struct would previously crash on load,
because loading from a save would clear the PuzzleData
struct after the pointer to it was acquired by the puzzle.
This commit adds second calls to getPuzzleData() in
those puzzles, ensuring the pointer will be correct.

Changed paths:
    engines/nancy/action/puzzle/assemblypuzzle.cpp
    engines/nancy/action/puzzle/riddlepuzzle.cpp
    engines/nancy/action/puzzle/rippedletterpuzzle.cpp
    engines/nancy/action/puzzle/sliderpuzzle.cpp
    engines/nancy/action/puzzle/soundequalizerpuzzle.cpp
    engines/nancy/action/puzzle/towerpuzzle.cpp


diff --git a/engines/nancy/action/puzzle/assemblypuzzle.cpp b/engines/nancy/action/puzzle/assemblypuzzle.cpp
index af3b5b5f111..c4fd6353294 100644
--- a/engines/nancy/action/puzzle/assemblypuzzle.cpp
+++ b/engines/nancy/action/puzzle/assemblypuzzle.cpp
@@ -118,6 +118,9 @@ void AssemblyPuzzle::readData(Common::SeekableReadStream &stream) {
 void AssemblyPuzzle::execute() {
 	switch (_state) {
 	case kBegin:
+		_puzzleState = (AssemblyPuzzleData *)NancySceneState.getPuzzleData(AssemblyPuzzleData::getTag());
+		assert(_puzzleState);
+
 		init();
 		registerGraphics();
 
diff --git a/engines/nancy/action/puzzle/riddlepuzzle.cpp b/engines/nancy/action/puzzle/riddlepuzzle.cpp
index a817a6fbfa2..76b5a586603 100644
--- a/engines/nancy/action/puzzle/riddlepuzzle.cpp
+++ b/engines/nancy/action/puzzle/riddlepuzzle.cpp
@@ -97,6 +97,9 @@ void RiddlePuzzle::readData(Common::SeekableReadStream &stream) {
 void RiddlePuzzle::execute() {
 	switch (_state) {
 	case kBegin: {
+		_puzzleState = (RiddlePuzzleData *)NancySceneState.getPuzzleData(RiddlePuzzleData::getTag());
+		assert(_puzzleState);
+
 		init();
 		registerGraphics();
 		_nextBlinkTime = g_nancy->getTotalPlayTime() + _cursorBlinkTime;
diff --git a/engines/nancy/action/puzzle/rippedletterpuzzle.cpp b/engines/nancy/action/puzzle/rippedletterpuzzle.cpp
index 36d7a0b65d8..59611e729f2 100644
--- a/engines/nancy/action/puzzle/rippedletterpuzzle.cpp
+++ b/engines/nancy/action/puzzle/rippedletterpuzzle.cpp
@@ -194,6 +194,9 @@ void RippedLetterPuzzle::readData(Common::SeekableReadStream &stream) {
 void RippedLetterPuzzle::execute() {
 	switch (_state) {
 	case kBegin:
+		_puzzleState = (RippedLetterPuzzleData *)NancySceneState.getPuzzleData(RippedLetterPuzzleData::getTag());
+		assert(_puzzleState);
+
 		init();
 		registerGraphics();
 
diff --git a/engines/nancy/action/puzzle/sliderpuzzle.cpp b/engines/nancy/action/puzzle/sliderpuzzle.cpp
index e66b199e4d3..d91377c5786 100644
--- a/engines/nancy/action/puzzle/sliderpuzzle.cpp
+++ b/engines/nancy/action/puzzle/sliderpuzzle.cpp
@@ -109,6 +109,9 @@ void SliderPuzzle::readData(Common::SeekableReadStream &stream) {
 void SliderPuzzle::execute() {
 	switch (_state) {
 	case kBegin:
+		_puzzleState = (SliderPuzzleData *)NancySceneState.getPuzzleData(SliderPuzzleData::getTag());
+		assert(_puzzleState);
+
 		init();
 		registerGraphics();
 		if (!_puzzleState->playerHasTriedPuzzle || !_retainState) {
diff --git a/engines/nancy/action/puzzle/soundequalizerpuzzle.cpp b/engines/nancy/action/puzzle/soundequalizerpuzzle.cpp
index d5f2bfa56c5..1deebe8b26d 100644
--- a/engines/nancy/action/puzzle/soundequalizerpuzzle.cpp
+++ b/engines/nancy/action/puzzle/soundequalizerpuzzle.cpp
@@ -192,6 +192,9 @@ void SoundEqualizerPuzzle::readData(Common::SeekableReadStream &stream) {
 void SoundEqualizerPuzzle::execute() {
 	switch(_state) {
 	case kBegin:
+		_puzzleState = (SoundEqualizerPuzzleData *)NancySceneState.getPuzzleData(SoundEqualizerPuzzleData::getTag());
+		assert(_puzzleState);
+
 		init();
 		registerGraphics();
 
diff --git a/engines/nancy/action/puzzle/towerpuzzle.cpp b/engines/nancy/action/puzzle/towerpuzzle.cpp
index 39a0d1bda8a..395a39a922f 100644
--- a/engines/nancy/action/puzzle/towerpuzzle.cpp
+++ b/engines/nancy/action/puzzle/towerpuzzle.cpp
@@ -96,6 +96,9 @@ void TowerPuzzle::readData(Common::SeekableReadStream &stream) {
 void TowerPuzzle::execute() {
 	switch (_state) {
 	case kBegin:
+		_puzzleState = (TowerPuzzleData *)NancySceneState.getPuzzleData(TowerPuzzleData::getTag());
+		assert(_puzzleState);
+
 		init();
 		registerGraphics();
 		_numRings = _numRingsByDifficulty[NancySceneState.getDifficulty()];




More information about the Scummvm-git-logs mailing list