Ticket #15006: macgui-menu-corruption.txt

File macgui-menu-corruption.txt, 1.5 KB (added by eriktorbjorn, 2 months ago)
Line 
1diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
2index 3d333839b6b..41de14620fb 100644
3--- a/graphics/macgui/macwindowmanager.cpp
4+++ b/graphics/macgui/macwindowmanager.cpp
5@@ -177,6 +177,8 @@ MacWindowManager::MacWindowManager(uint32 mode, MacPatterns *patterns, Common::L
6 _menuDelay = 0;
7 _menuTimerActive = false;
8
9+ _activateScreenCopy = false;
10+
11 _engineP = nullptr;
12 _engineR = nullptr;
13 _redrawEngineCallback = nullptr;
14@@ -447,14 +449,14 @@ void MacWindowManager::activateMenu() {
15 return;
16
17 if (_mode & kWMModalMenuMode) {
18- activateScreenCopy();
19+ _activateScreenCopy = true;
20 }
21
22 _menu->setVisible(true);
23 }
24
25 void MacWindowManager::activateScreenCopy() {
26- Common::StackLock lock(_mutex);
27+ // This is only called when the _mutex is already held
28
29 if (_screen) {
30 if (!_screenCopy)
31@@ -897,6 +899,11 @@ void MacWindowManager::drawDesktop() {
32 void MacWindowManager::draw() {
33 Common::StackLock lock(_mutex);
34
35+ if (_activateScreenCopy) {
36+ _activateScreenCopy = false;
37+ activateScreenCopy();
38+ }
39+
40 removeMarked();
41
42 Common::Rect bounds = getScreenBounds();
43diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h
44index 22a128c77a0..feeb3a7ca98 100644
45--- a/graphics/macgui/macwindowmanager.h
46+++ b/graphics/macgui/macwindowmanager.h
47@@ -457,6 +457,8 @@ private:
48 MacMenu *_menu;
49 uint32 _menuDelay;
50
51+ bool _activateScreenCopy;
52+
53 Engine *_engineP;
54 void *_engineR;
55 void (*_redrawEngineCallback)(void *engine);