fix: replace TagController.dispose() misuse with closeOverlay() method#41
Merged
Merged
Conversation
dispose() was being called on every pointer-down to close the tag overlay, which would cause a double-dispose exception if TagController ever gains a field that does not tolerate calling dispose() twice (StreamSubscription, AnimationController, etc.). Adds closeOverlay() as the correct API for runtime close operations. dispose() now calls closeOverlay() internally and asserts it is only called once. Updates the Listener.onPointerDown handler and the inline close in handleTextChanged() to use closeOverlay(). Adds TagController unit tests covering the new semantics. Closes #38 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
closeOverlay()toTagControlleras the correct API for runtime close operations — timer cancel + overlay remove, callable any number of timesdispose()delegates tocloseOverlay()and asserts it is only called once (debug-mode guard against future fragility)Listener.onPointerDowninnote_edit.dartfromdispose()tocloseOverlay()handleTextChanged()to callcloseOverlay()Test plan
flutter test test/controllers/tag_controller_test.dart— 3 new tests pass (no-op on empty, idempotent multiple calls, second dispose asserts)flutter analyze— no issuesCloses #38
🤖 Generated with Claude Code