Telemetry: Make isReportingCrash static to avoid creating the singleton in the event filter

RiaGuiApplication::notify queried RiaOpenTelemetryManager::instance() for every event. Make the crash flag a static atomic so the check never constructs the manager or takes part in its initialization.
This commit is contained in:
Magne Sjaastad committed 2026-10-19 12:05:12 +02:00
1 parent 8dc1d56bd3
commit c180247db2
3 files changed
+5 -5

No files matched your search

@@ -1883,7 +1883,7 @@ bool RiaGuiApplication::notify( QObject* receiver, QEvent* event )
// The crash handler pumps the event loop to send the crash report. Repainting a widget there can re-enter the
// faulting code and crash again, replacing the original report with one blaming the crash handler.
if ( RiaOpenTelemetryManager::instance().isReportingCrash() && ( receiver->isWidgetType() || receiver->isWindowType() ) )
if ( RiaOpenTelemetryManager::isReportingCrash() && ( receiver->isWidgetType() || receiver->isWindowType() ) )
{
return false;
}
@@ -456,7 +456,7 @@ bool RiaOpenTelemetryManager::isInitialized() const
//--------------------------------------------------------------------------------------------------
/// True while the crash handler sends a crash report. Never reset, the process exits afterwards.
//--------------------------------------------------------------------------------------------------
bool RiaOpenTelemetryManager::isReportingCrash() const
bool RiaOpenTelemetryManager::isReportingCrash()
{
return m_isReportingCrash.load();
}
@@ -110,8 +110,8 @@ public:
// Configuration
bool isEnabled() const;
bool isInitialized() const;
bool isReportingCrash() const;
bool isInitialized() const;
static bool isReportingCrash();
void setErrorCallback( ErrorCallback callback );
void setUsername( const std::string& username );
@@ -181,7 +181,7 @@ private:
std::atomic<bool> m_enabled{ false };
std::atomic<bool> m_isShuttingDown{ false };
std::atomic<bool> m_circuitBreakerOpen{ false };
std::atomic<bool> m_isReportingCrash{ false };
static inline std::atomic<bool> m_isReportingCrash{ false };
// Qt networking and timer
QNetworkAccessManager* m_networkAccessManager{ nullptr };