Skip to content

fix: 🐛 null-check crash in ShowcaseController._initRootWidget when the Showcase is unmounted in the same frame it mounts (#659) - #665

Open
apurva010 wants to merge 1 commit into
masterfrom
fix/issue_659_null_check_error_on_register_state_disposed
Open

apurva010 wants to merge 1 commit into
masterfrom
fix/issue_659_null_check_error_on_register_state_disposed

Conversation

@apurva010

Copy link
Copy Markdown
Contributor

Description

Checklist

  • The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

Related Issues

Closes #659

…the `Showcase` is unmounted in the same frame it mounts (#659)
@dmallo97

Copy link
Copy Markdown

Thanks for the fix! There's a second unguarded _context access on the same path: scrollIntoView awaits Scrollable.ensureVisible and then calls _waitForScrollToSettle, whose first line is Scrollable.maybeOf(_context). If the target is unmounted during the scroll (e.g. with enableAutoScroll: true), it throws the same null-check error in release. The same guard at the top of _waitForScrollToSettle would cover it:

Future<void> _waitForScrollToSettle({...}) async {
  if (!_mounted) return;
  final scrollableState = Scrollable.maybeOf(_context);

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Null check error on register when state disposed

2 participants