1
0
Fork 0

Sentry: use new SimGear reporting control

This commit is contained in:
James Turner 2021-07-31 17:22:31 +01:00
parent a156c5a14d
commit 66b5c4259e
2 changed files with 3 additions and 22 deletions

View file

@ -25,6 +25,8 @@
#include <simgear/debug/LogCallback.hxx> #include <simgear/debug/LogCallback.hxx>
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include <simgear/debug/ErrorReportingCallback.hxx> #include <simgear/debug/ErrorReportingCallback.hxx>
#include <simgear/debug/Reporting.hxx>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <simgear/props/props.hxx> #include <simgear/props/props.hxx>
#include <simgear/structure/commands.hxx> #include <simgear/structure/commands.hxx>
@ -76,7 +78,6 @@ auto exception_messageWhitelist = {
#if defined(HAVE_SENTRY) && !defined(BUILDING_TESTSUITE) #if defined(HAVE_SENTRY) && !defined(BUILDING_TESTSUITE)
static bool static_sentryEnabled = false; static bool static_sentryEnabled = false;
thread_local bool perThread_reportAllocErrors = true;
#include <sentry.h> #include <sentry.h>
@ -201,7 +202,7 @@ void sentrySimgearReportCallback(const string& msg, const string& more, bool isF
void sentryReportBadAlloc() void sentryReportBadAlloc()
{ {
if (perThread_reportAllocErrors) { if (simgear::ReportBadAllocGuard::isSet()) {
sentry_value_t sentryMessage = sentry_value_new_object(); 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, "type", sentry_value_new_string("Fatal Error"));
sentry_value_set_by_key(sentryMessage, "formatted", sentry_value_new_string("bad allocation")); 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()); 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 } // of namespace flightgear

View file

@ -48,12 +48,6 @@ void sentryReportFatalError(const std::string& msg, const std::string& more = {}
void sentryReportUserError(const std::string& aggregate, const std::string& details); void sentryReportUserError(const std::string& aggregate, const std::string& details);
class SentryAllocErrorSupression
{
public:
SentryAllocErrorSupression();
~SentryAllocErrorSupression();
};
} // of namespace flightgear } // of namespace flightgear