From 15c7df14809875742341fee750241b6215b7c28a Mon Sep 17 00:00:00 2001 From: Reece Date: Wed, 21 Dec 2022 23:37:41 +0000 Subject: [PATCH] [*] Disable telemetry reporting after runtime shutdown to prevent null exceptions from being reported under TLS. Fixes deadlock and a crash. --- Source/Grug/AuArrow.cpp | 16 ++++++++++++++++ Source/Grug/AuArrow.hpp | 1 + Source/Grug/AuGrug.cpp | 2 ++ 3 files changed, 19 insertions(+) diff --git a/Source/Grug/AuArrow.cpp b/Source/Grug/AuArrow.cpp index c59f9b66..c5763e85 100644 --- a/Source/Grug/AuArrow.cpp +++ b/Source/Grug/AuArrow.cpp @@ -15,6 +15,7 @@ namespace Aurora::Grug { static AuList gReservedArrows; // stacks are slower than vectors under msvc, 'twas a qst bottleneck static AuThreadPrimitives::SpinLock gSpinLock; + static bool gDisableGrugMessages {}; void SignalSafeSleepLockYield(AuThreadPrimitives::SpinLock &lock) { @@ -30,6 +31,11 @@ namespace Aurora::Grug void HurlArrow(Arrow *pArrow, GrugReport_f pCallback, GrugReport_f pCallbackRunaway) { + if (gDisableGrugMessages) + { + return; + } + pArrow->pCallback = pCallback; pArrow->pCallbackRunaway = pCallbackRunaway; @@ -54,6 +60,11 @@ namespace Aurora::Grug void ArrowWait(Arrow *arrow) { + if (gDisableGrugMessages) + { + return; + } + AU_LOCK_GUARD(arrow->spinSemaphore); } @@ -131,4 +142,9 @@ namespace Aurora::Grug { gReservedArrows.reserve(20); } + + void DeinitArrows() + { + gDisableGrugMessages = true; + } } \ No newline at end of file diff --git a/Source/Grug/AuArrow.hpp b/Source/Grug/AuArrow.hpp index 9e2789f2..ffd82de4 100644 --- a/Source/Grug/AuArrow.hpp +++ b/Source/Grug/AuArrow.hpp @@ -28,4 +28,5 @@ namespace Aurora::Grug void HurlFatalEvent(Arrow *pArrow); void DequeueOneArrow(); + void DeinitArrows(); } \ No newline at end of file diff --git a/Source/Grug/AuGrug.cpp b/Source/Grug/AuGrug.cpp index 96937c7d..762874ae 100644 --- a/Source/Grug/AuGrug.cpp +++ b/Source/Grug/AuGrug.cpp @@ -156,6 +156,8 @@ namespace Aurora::Grug gMutex.reset(); gCondVar.reset(); gArrows.reset(); + + DeinitArrows(); } void NotifyGrugOfTelemetry()