Skip to content

Conversation

@limbonaut
Copy link
Collaborator

@limbonaut limbonaut commented Aug 20, 2025

This PR cleans up and restructures initialization flow in preparation for lifecycle methods, extracted from #321.

  • Clean up module initialization and class registration.
  • Add SentrySDK create_singleton()/destroy_singleton() functions for cleaner code.
  • Separate SentrySDK construction from SDK auto initialization.
    • Ensure InternalSDK interface is created early (in constructor).
    • Move startup and initialization logic from constructor into prepare_and_auto_initialize() method.
  • Rename InternalSDK initialize() => init() to better align with Sentry terminology.
  • Better function names.

These changes make it easier to follow the initialization flow and reduce the risk of errors.

@limbonaut limbonaut marked this pull request as ready for review August 20, 2025 11:16
@limbonaut limbonaut changed the title ref: Impove initialization flow ref: Improve initialization flow Aug 20, 2025
cursor[bot]

This comment was marked as outdated.

@limbonaut limbonaut merged commit 485a7e4 into main Aug 25, 2025
36 checks passed
@limbonaut limbonaut deleted the ref/impove-initialization-extracted branch August 25, 2025 13:30
should_enable = false;
#endif
}
#endif
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: SDK Initialization Fails on Unsupported Platforms

The _auto_initialize method doesn't correctly update the enabled flag when the SDK is effectively disabled. This occurs on unsupported platforms or when the Android plugin is missing. Although the constructor correctly sets internal_sdk to DisabledSDK in these cases, is_enabled() returns an incorrect true, leading to an inconsistent SDK state.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants