mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
Common: Fix logging shutdown race condition.
Got a crash during logging on another thread during shutdown.
This commit is contained in:
parent
84aa33970b
commit
f57c642f0b
@ -156,6 +156,9 @@ LogManager::~LogManager() {
|
||||
#endif
|
||||
}
|
||||
|
||||
// Make sure we don't shutdown while logging. RemoveListener locks too, but there are gaps.
|
||||
std::lock_guard<std::mutex> listeners_lock(listeners_lock_);
|
||||
|
||||
if (fileLog_)
|
||||
delete fileLog_;
|
||||
#if !defined(MOBILE_DEVICE) || defined(_DEBUG)
|
||||
@ -262,6 +265,7 @@ bool LogManager::IsEnabled(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type)
|
||||
}
|
||||
|
||||
void LogManager::Init(bool *enabledSetting) {
|
||||
_assert_(logManager_ == nullptr);
|
||||
logManager_ = new LogManager(enabledSetting);
|
||||
}
|
||||
|
||||
|
@ -1402,14 +1402,6 @@ void NativeShutdown() {
|
||||
#endif
|
||||
g_Config.Save("NativeShutdown");
|
||||
|
||||
// Avoid shutting this down when restarting core.
|
||||
if (!restarting)
|
||||
LogManager::Shutdown();
|
||||
|
||||
#ifdef ANDROID_NDK_PROFILER
|
||||
moncleanup();
|
||||
#endif
|
||||
|
||||
INFO_LOG(SYSTEM, "NativeShutdown called");
|
||||
|
||||
ShutdownWebServer();
|
||||
@ -1420,6 +1412,14 @@ void NativeShutdown() {
|
||||
|
||||
g_Discord.Shutdown();
|
||||
|
||||
// Avoid shutting this down when restarting core.
|
||||
if (!restarting)
|
||||
LogManager::Shutdown();
|
||||
|
||||
#ifdef ANDROID_NDK_PROFILER
|
||||
moncleanup();
|
||||
#endif
|
||||
|
||||
if (logger) {
|
||||
delete logger;
|
||||
logger = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user