From f2fc533c341c518bc8fe5255c9180ccd30eaa824 Mon Sep 17 00:00:00 2001 From: gusabary Date: Tue, 8 Dec 2020 15:09:10 +0800 Subject: [PATCH] fix: protect print of specifying next color with lock --- src/ui/ui_manager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ui/ui_manager.cpp b/src/ui/ui_manager.cpp index 4806524..4730308 100644 --- a/src/ui/ui_manager.cpp +++ b/src/ui/ui_manager.cpp @@ -145,7 +145,10 @@ std::pair UIManager::GetAction(bool lastCardCanBePlayed, CardColor UIManager::SpecifyNextColor() { mIsSpecifyingNextColor = true; - Print(); + { + std::lock_guard lock(mMutex); + Print(); + } CardColor nextColor; ExecuteWithTimePassing([this, &nextColor] {