Rename Memory::Lock() to Core_LockAgainstShutdown(), move it to Core

It stopped being about memory when CPU_Shutdown started holding it across the
whole teardown - it's what keeps kernel objects, the symbol map and the memory
map from being freed while another thread reads them. The old name invited the
reading that it locks memory *access*, which it has never done.

Memory::Reinit() now holds it across both halves rather than relying on
Memory::Shutdown()'s own acquire: between Shutdown() and Init() there is no
memory map at all, and a reader could slip into that gap.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GZq8ZtJmFY7bkX5FVkr3P9
This commit is contained in:
Henrik RydgårdandClaude Opus 5 committed 2026-08-17 13:11:16 +02:00
1 parent f57a102027
commit 75ff0d406c
16 files changed
+76 -66

No files matched your search

+2 -2
View File
@@ -730,7 +730,7 @@ void CDisasm::Show(bool bShow, bool includeToTop) {
// thread - hold g_frameMutex for the duration of the read, which NativeFrame() also
// holds while it's actually touching that state. See g_frameMutex in Core.h.
std::lock_guard<std::mutex> frameGuard(g_frameMutex);
Memory::MemoryInitedLock memLock = Memory::Lock();
CoreShutdownLock coreLock = Core_LockAgainstShutdown();
g_symbolMap->FillSymbolListBox(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST), ST_FUNCTION);
deferredSymbolFill_ = false;
}
@@ -741,7 +741,7 @@ void CDisasm::Show(bool bShow, bool includeToTop) {
void CDisasm::NotifyMapLoaded() {
if (m_bShowState != SW_HIDE && g_symbolMap) {
std::lock_guard<std::mutex> frameGuard(g_frameMutex);
Memory::MemoryInitedLock memLock = Memory::Lock();
CoreShutdownLock coreLock = Core_LockAgainstShutdown();
g_symbolMap->FillSymbolListBox(GetDlgItem(m_hDlg, IDC_FUNCTIONLIST), ST_FUNCTION);
} else {
deferredSymbolFill_ = true;