diff --git a/Sources/Sentry/SentryCrashIntegration.m b/Sources/Sentry/SentryCrashIntegration.m index 112295f0444..ba5d6dffd23 100644 --- a/Sources/Sentry/SentryCrashIntegration.m +++ b/Sources/Sentry/SentryCrashIntegration.m @@ -89,11 +89,13 @@ - (BOOL)installWithOptions:(nonnull SentryOptions *)options self.scopeObserver = [[SentryCrashScopeObserver alloc] initWithMaxBreadcrumbs:options.maxBreadcrumbs]; - [self startCrashHandler:options.cacheDirectoryPath + BOOL enableSigtermReporting = NO; #if !TARGET_OS_WATCH - enableSigtermReporting:options.enableSigtermReporting + enableSigtermReporting = options.enableSigtermReporting; #endif // !TARGET_OS_WATCH - ]; + + [self startCrashHandler:options.cacheDirectoryPath + enableSigtermReporting:enableSigtermReporting]; [self configureScope]; @@ -106,9 +108,7 @@ - (SentryIntegrationOption)integrationOptions } - (void)startCrashHandler:(NSString *)cacheDirectory -#if !TARGET_OS_WATCH enableSigtermReporting:(BOOL)enableSigtermReporting -#endif // !TARGET_OS_WATCH { void (^block)(void) = ^{ BOOL canSendReports = NO; @@ -125,9 +125,7 @@ - (void)startCrashHandler:(NSString *)cacheDirectory canSendReports = YES; } -#if !TARGET_OS_WATCH sentrycrashcm_setEnableSigtermReporting(enableSigtermReporting); -#endif // !TARGET_OS_WATCH [installation install:cacheDirectory]; diff --git a/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_Signal.c b/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_Signal.c index 9c497ab610b..39d17ffca71 100644 --- a/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_Signal.c +++ b/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_Signal.c @@ -51,12 +51,6 @@ static volatile bool g_isEnabled = false; static bool g_isSigtermReportingEnabled = false; -void -sentrycrashcm_setEnableSigtermReporting(bool enabled) -{ - g_isSigtermReportingEnabled = enabled; -} - static SentryCrash_MonitorContext g_monitorContext; static SentryCrashStackCursor g_stackCursor; @@ -263,6 +257,14 @@ addContextualInfoToEvent(struct SentryCrash_MonitorContext *eventContext) #endif +void +sentrycrashcm_setEnableSigtermReporting(bool enabled) +{ +#if SentryCrashCRASH_HAS_SIGNAL + g_isSigtermReportingEnabled = enabled; +#endif +} + SentryCrashMonitorAPI * sentrycrashcm_signal_getAPI(void) {