From 66b5c4259ebaf70a728e5539ef268d11c3b7ab81 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sat, 31 Jul 2021 17:22:31 +0100 Subject: [PATCH] Sentry: use new SimGear reporting control --- src/Main/sentryIntegration.cxx | 19 +++---------------- src/Main/sentryIntegration.hxx | 6 ------ 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/src/Main/sentryIntegration.cxx b/src/Main/sentryIntegration.cxx index 5b383a2b3..b3037ce18 100644 --- a/src/Main/sentryIntegration.cxx +++ b/src/Main/sentryIntegration.cxx @@ -25,6 +25,8 @@ #include #include #include +#include + #include #include #include @@ -76,7 +78,6 @@ auto exception_messageWhitelist = { #if defined(HAVE_SENTRY) && !defined(BUILDING_TESTSUITE) static bool static_sentryEnabled = false; -thread_local bool perThread_reportAllocErrors = true; #include @@ -201,7 +202,7 @@ void sentrySimgearReportCallback(const string& msg, const string& more, bool isF void sentryReportBadAlloc() { - if (perThread_reportAllocErrors) { + if (simgear::ReportBadAllocGuard::isSet()) { sentry_value_t sentryMessage = sentry_value_new_object(); sentry_value_set_by_key(sentryMessage, "type", sentry_value_new_string("Fatal Error")); sentry_value_set_by_key(sentryMessage, "formatted", sentry_value_new_string("bad allocation")); @@ -565,18 +566,4 @@ void addSentryTag(const std::string& tag, const std::string& value) addSentryTag(tag.c_str(), value.c_str()); } -SentryAllocErrorSupression::SentryAllocErrorSupression() -{ -#if defined(HAVE_SENTRY) && !defined(BUILDING_TESTSUITE) - perThread_reportAllocErrors = false; -#endif -} - -SentryAllocErrorSupression::~SentryAllocErrorSupression() -{ -#if defined(HAVE_SENTRY) && !defined(BUILDING_TESTSUITE) - perThread_reportAllocErrors = true; -#endif -} - } // of namespace flightgear diff --git a/src/Main/sentryIntegration.hxx b/src/Main/sentryIntegration.hxx index 4b68d27c7..6112c90a7 100644 --- a/src/Main/sentryIntegration.hxx +++ b/src/Main/sentryIntegration.hxx @@ -48,12 +48,6 @@ void sentryReportFatalError(const std::string& msg, const std::string& more = {} void sentryReportUserError(const std::string& aggregate, const std::string& details); -class SentryAllocErrorSupression -{ -public: - SentryAllocErrorSupression(); - ~SentryAllocErrorSupression(); -}; } // of namespace flightgear