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