From a513fa7597a00a251c174a5050f60bce492ec689 Mon Sep 17 00:00:00 2001 From: MatthewBeshay <92357869+MatthewBeshay@users.noreply.github.com> Date: Tue, 31 Mar 2026 00:16:16 +1100 Subject: [PATCH] Rename CriticalSection wrapper functions to match std::mutex usage EnterCallbackIdCriticalSection/LeaveCallbackIdCriticalSection -> lockCallbackScenes/unlockCallbackScenes, EnterSaveNotificationSection/LeaveSaveNotificationSection -> lockSaveNotification/unlockSaveNotification, m_saveNotificationCriticalSection -> m_saveNotificationMutex. --- Minecraft.Client/MinecraftServer.cpp | 8 ++++---- Minecraft.Client/Platform/Common/Consoles_App.cpp | 8 ++++---- Minecraft.Client/Platform/Common/Consoles_App.h | 6 +++--- Minecraft.Client/Platform/Common/UI/UIController.cpp | 4 ++-- Minecraft.Client/Platform/Common/UI/UIController.h | 4 ++-- .../Common/UI/UIScene_InGameSaveManagementMenu.cpp | 2 +- .../Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp | 4 ++-- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Minecraft.Client/MinecraftServer.cpp b/Minecraft.Client/MinecraftServer.cpp index 0c4d1b2db..c914a5d80 100644 --- a/Minecraft.Client/MinecraftServer.cpp +++ b/Minecraft.Client/MinecraftServer.cpp @@ -1176,7 +1176,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { switch (eAction) { case eXuiServerAction_AutoSaveGame: case eXuiServerAction_SaveGame: - app.EnterSaveNotificationSection(); + app.lockSaveNotification(); if (players != nullptr) { players->saveAll( Minecraft::GetInstance()->progressRenderer); @@ -1211,7 +1211,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { Minecraft::GetInstance()->progressRenderer, (eAction == eXuiServerAction_AutoSaveGame)); } - app.LeaveSaveNotificationSection(); + app.unlockSaveNotification(); break; case eXuiServerAction_DropItem: // Find the player, and drop the id at their feet @@ -1292,7 +1292,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { break; case eXuiServerAction_ExportSchematic: #if !defined(_CONTENT_PACKAGE) - app.EnterSaveNotificationSection(); + app.lockSaveNotification(); // players->broadcastAll( // shared_ptr( new @@ -1326,7 +1326,7 @@ void MinecraftServer::run(int64_t seed, void* lpParameter) { delete initData; } - app.LeaveSaveNotificationSection(); + app.unlockSaveNotification(); #endif break; case eXuiServerAction_SetCameraLocation: diff --git a/Minecraft.Client/Platform/Common/Consoles_App.cpp b/Minecraft.Client/Platform/Common/Consoles_App.cpp index 5eff1864f..edc049903 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.cpp +++ b/Minecraft.Client/Platform/Common/Consoles_App.cpp @@ -5641,8 +5641,8 @@ DLC_INFO* CMinecraftApp::GetDLCInfoForFullOfferID(uint64_t ullOfferID_Full) { return nullptr; } -void CMinecraftApp::EnterSaveNotificationSection() { - std::lock_guard lock(m_saveNotificationCriticalSection); +void CMinecraftApp::lockSaveNotification() { + std::lock_guard lock(m_saveNotificationMutex); if (m_saveNotificationDepth++ == 0) { if (g_NetworkManager .IsInSession()) // this can be triggered from the front end if @@ -5660,8 +5660,8 @@ void CMinecraftApp::EnterSaveNotificationSection() { } } -void CMinecraftApp::LeaveSaveNotificationSection() { - std::lock_guard lock(m_saveNotificationCriticalSection); +void CMinecraftApp::unlockSaveNotification() { + std::lock_guard lock(m_saveNotificationMutex); if (--m_saveNotificationDepth == 0) { if (g_NetworkManager .IsInSession()) // this can be triggered from the front end if diff --git a/Minecraft.Client/Platform/Common/Consoles_App.h b/Minecraft.Client/Platform/Common/Consoles_App.h index 36c47839d..9263ac5b2 100644 --- a/Minecraft.Client/Platform/Common/Consoles_App.h +++ b/Minecraft.Client/Platform/Common/Consoles_App.h @@ -880,11 +880,11 @@ public: void SetCorruptSaveDeleted(bool bVal) { m_bCorruptSaveDeleted = bVal; } bool GetCorruptSaveDeleted(void) { return m_bCorruptSaveDeleted; } - void EnterSaveNotificationSection(); - void LeaveSaveNotificationSection(); + void lockSaveNotification(); + void unlockSaveNotification(); private: - std::mutex m_saveNotificationCriticalSection; + std::mutex m_saveNotificationMutex; int m_saveNotificationDepth; // Download Status diff --git a/Minecraft.Client/Platform/Common/UI/UIController.cpp b/Minecraft.Client/Platform/Common/UI/UIController.cpp index bb3f23978..f5a80b595 100644 --- a/Minecraft.Client/Platform/Common/UI/UIController.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIController.cpp @@ -1400,11 +1400,11 @@ UIScene* UIController::GetSceneFromCallbackId(size_t id) { return scene; } -void UIController::EnterCallbackIdCriticalSection() { +void UIController::lockCallbackScenes() { m_registeredCallbackScenesCS.lock(); } -void UIController::LeaveCallbackIdCriticalSection() { +void UIController::unlockCallbackScenes() { m_registeredCallbackScenesCS.unlock(); } diff --git a/Minecraft.Client/Platform/Common/UI/UIController.h b/Minecraft.Client/Platform/Common/UI/UIController.h index 26acadedb..09223ba6d 100644 --- a/Minecraft.Client/Platform/Common/UI/UIController.h +++ b/Minecraft.Client/Platform/Common/UI/UIController.h @@ -312,8 +312,8 @@ public: size_t RegisterForCallbackId(UIScene* scene); void UnregisterCallbackId(size_t id); UIScene* GetSceneFromCallbackId(size_t id); - void EnterCallbackIdCriticalSection(); - void LeaveCallbackIdCriticalSection(); + void lockCallbackScenes(); + void unlockCallbackScenes(); private: void setFullscreenMenuDisplayed(bool displayed); diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp index 5aceeb6c1..ed88edf2a 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_InGameSaveManagementMenu.cpp @@ -95,7 +95,7 @@ UIScene_InGameSaveManagementMenu::~UIScene_InGameSaveManagementMenu() { } delete[] m_saveDetails; } - app.LeaveSaveNotificationSection(); + app.unlockSaveNotification(); StorageManager.SetSaveDisabled(false); StorageManager.ContinueIncompleteOperation(); } diff --git a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp index e8ddcbce4..5228a5787 100644 --- a/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Platform/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -1442,7 +1442,7 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned( } int UIScene_LoadOrJoinMenu::DeleteSaveDataReturned(void* lpParam, bool bRes) { - ui.EnterCallbackIdCriticalSection(); + ui.lockCallbackScenes(); UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParam); @@ -1455,7 +1455,7 @@ int UIScene_LoadOrJoinMenu::DeleteSaveDataReturned(void* lpParam, bool bRes) { pClass->updateTooltips(); } - ui.LeaveCallbackIdCriticalSection(); + ui.unlockCallbackScenes(); return 0; }