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

bluegr noreply at scummvm.org
Sun Jan 2 13:40:16 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:
e50957ba7f BURIED: Fix global flag corruption in completion screen


Commit: e50957ba7fdbdc7496080490153f40ad84f22c3c
    https://github.com/scummvm/scummvm/commit/e50957ba7fdbdc7496080490153f40ad84f22c3c
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2022-01-02T15:40:00+02:00

Commit Message:
BURIED: Fix global flag corruption in completion screen

Changed paths:
    engines/buried/complete.cpp
    engines/buried/complete.h
    engines/buried/frame_window.cpp


diff --git a/engines/buried/complete.cpp b/engines/buried/complete.cpp
index 88d68eaf574..e8f37b22760 100644
--- a/engines/buried/complete.cpp
+++ b/engines/buried/complete.cpp
@@ -52,7 +52,7 @@ namespace Buried {
 	if (_globalFlags.evcapBaseID[i] == flag) \
 		supportingEvidence++
 
-CompletionWindow::CompletionWindow(BuriedEngine *vm, Window *parent, GlobalFlags &globalFlags) : Window(vm, parent), _globalFlags(globalFlags) {
+CompletionWindow::CompletionWindow(BuriedEngine *vm, Window *parent, GlobalFlags globalFlags) : Window(vm, parent), _globalFlags(globalFlags) {
 	_vm->_sound->setAmbientSound();
 
 	_status = 0;
diff --git a/engines/buried/complete.h b/engines/buried/complete.h
index 25a5aaadde6..ae49492d61f 100644
--- a/engines/buried/complete.h
+++ b/engines/buried/complete.h
@@ -39,7 +39,7 @@ class VideoWindow;
 
 class CompletionWindow : public Window {
 public:
-	CompletionWindow(BuriedEngine *vm, Window *parent, GlobalFlags &globalFlags);
+	CompletionWindow(BuriedEngine *vm, Window *parent, GlobalFlags globalFlags);
 	~CompletionWindow();
 
 	void onPaint();
diff --git a/engines/buried/frame_window.cpp b/engines/buried/frame_window.cpp
index 86e6b74f449..ef89f891ef8 100644
--- a/engines/buried/frame_window.cpp
+++ b/engines/buried/frame_window.cpp
@@ -287,8 +287,13 @@ bool FrameWindow::showCompletionScene(GlobalFlags &globalFlags) {
 
 	_vm->removeMouseMessages(this);
 
+	// Pass globalFlags by value to CompletionWindow here, as they will be destroyed
+	// together with _mainChildWindow (a GameUIWindow, which contains the scene
+	// window, which holds the instance of the global flags)
+	CompletionWindow *completionWindow = new CompletionWindow(_vm, this, globalFlags);
+
 	delete _mainChildWindow;
-	_mainChildWindow = new CompletionWindow(_vm, this, globalFlags);
+	_mainChildWindow = completionWindow;
 	_mainChildWindow->showWindow(kWindowShow);
 	_mainChildWindow->invalidateWindow(false);
 




More information about the Scummvm-git-logs mailing list