@@ -613,36 +613,39 @@ + (void)close
613613{
614614 SENTRY_LOG_DEBUG (@" Starting to close SDK." );
615615
616+ [SentryDependencyContainer.sharedInstance.dispatchQueueWrapper dispatchSyncOnMainQueue: ^{
617+
616618#if SENTRY_TARGET_PROFILING_SUPPORTED
617- [SentryContinuousProfiler stop ];
619+ [SentryContinuousProfiler stop ];
618620#endif // SENTRY_TARGET_PROFILING_SUPPORTED
619621
620- startTimestamp = nil ;
622+ startTimestamp = nil ;
621623
622- SentryHubInternal *hub = SentrySDKInternal.currentHub ;
623- [hub removeAllIntegrations ];
624+ SentryHubInternal *hub = SentrySDKInternal.currentHub ;
625+ [hub removeAllIntegrations ];
624626
625- SENTRY_LOG_DEBUG (@" Uninstalled all integrations." );
627+ SENTRY_LOG_DEBUG (@" Uninstalled all integrations." );
626628
627629#if SENTRY_HAS_UIKIT
628- // force the AppStateManager to unsubscribe, see
629- // https://github.com/getsentry/sentry-cocoa/issues/2455
630- [[SentryDependencyContainer sharedInstance ].appStateManager stopWithForce: YES ];
630+ // force the AppStateManager to unsubscribe, see
631+ // https://github.com/getsentry/sentry-cocoa/issues/2455
632+ [[SentryDependencyContainer sharedInstance ].appStateManager stopWithForce: YES ];
631633#endif
632634
633- [hub close ];
634- [hub bindClient: nil ];
635+ [hub close ];
636+ [hub bindClient: nil ];
635637
636- [SentrySDKInternal setCurrentHub: nil ];
638+ [SentrySDKInternal setCurrentHub: nil ];
637639
638- [SentryDependencyContainer.sharedInstance.crashWrapper stopBinaryImageCache ];
639- [SentryDependencyContainer.sharedInstance.binaryImageCache stop ];
640+ [SentryDependencyContainer.sharedInstance.crashWrapper stopBinaryImageCache ];
641+ [SentryDependencyContainer.sharedInstance.binaryImageCache stop ];
640642
641643#if TARGET_OS_IOS && SENTRY_HAS_UIKIT
642- [SentryDependencyContainer.sharedInstance.uiDeviceWrapper stop ];
644+ [SentryDependencyContainer.sharedInstance.uiDeviceWrapper stop ];
643645#endif // TARGET_OS_IOS && SENTRY_HAS_UIKIT
644646
645- [SentryDependencyContainer reset ];
647+ [SentryDependencyContainer reset ];
648+ }];
646649 SENTRY_LOG_DEBUG (@" SDK closed!" );
647650}
648651
0 commit comments