diff --git a/CHANGELOG.md b/CHANGELOG.md index 0dcd52bc..f3095f45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 5.1.1 [#unreleased] + +- Fixed [#659](https://github.com/SimformSolutionsPvtLtd/showcaseview/issues/659) - Fix null-check crash in `ShowcaseController._initRootWidget` when the `Showcase` is unmounted in the same frame it mounts. Fixed by @[apurva-simform](https://github.com/apurva-simform) + ## 5.1.0 - Fixed [#650](https://github.com/SimformSolutionsPvtLtd/showcaseview/issues/650) - Fix null-check crash in ShowcaseService.getController during didUpdateWidget. Fixed by @[vatsaltanna-simformsolutions](https://github.com/vatsaltanna-simformsolutions) diff --git a/lib/src/showcase/showcase_controller.dart b/lib/src/showcase/showcase_controller.dart index 865e5169..42ee379f 100644 --- a/lib/src/showcase/showcase_controller.dart +++ b/lib/src/showcase/showcase_controller.dart @@ -274,6 +274,9 @@ class ShowcaseController { /// /// Must be called after the widget is mounted to ensure proper measurements. void _initRootWidget() { + // register()'s post-frame callback can fire after the Showcase was + // unmounted in the same frame, and State.context throws on a dead State. + if (!_mounted) return; final rootWidget = _context.findRootAncestorStateOfType>(); rootRenderObject = rootWidget?.context.findRenderObject() as RenderBox?; rootWidgetSize = rootWidget == null