Repository navigation
Fix memory leaks in the editor, selection overlay, and toolbar - #5
Merged
Merged
Conversation
- Dispose notifiers, controllers and overlay entries the editor creates. - Remove listeners/observers registered on external objects on dispose. - Fix controller swap removing a different listener than was added. - QuillEditor focusNode/scrollController are optional and owned by the state when omitted. - Add leak-tracking widget tests.
Record the 11.5.0 changelog for the focus node, leak fixes, and native bridge fork.
Flutter stable rejects Gradle 8.7, so the wrapper, Android Gradle plugin, Kotlin, and Java target move to the current template versions.
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
Fixes the flutter_quill leaks reported by the app's UI-test leak tracker, plus several more found while auditing the library. Several of these kept the whole editor state reachable after unmount.
Objects never disposed
composingRangeand_floatingCursorResetControllerinQuillRawEditorStateCursorCont._floatingCursorTextPositionQuillEditorState.dragOffsetNotifierRenderEditor._selectionStartInViewport/_selectionEndInViewportOverlayEntrys (were onlyremove()d)FocusNodeandClipboardStatusNotifierrecreated on every buildColorPickerDialoghexTextEditingControllerListeners that retained the editor
WidgetsBindingobserver was only removed on blur, so disposing a focused editor leaked itScrollControllernever removedreadOnlychangedQuillEditorStatecould never be removedcontroller.changessubscriptiondidUpdateWidgetremoved_didChangeTextEditingValuebutinitStateadded_didChangeTextEditingValueListener, so swapping controllers left the editor attached to the old oneBreaking change
QuillEditor.focusNodeandscrollControllerare now optional. When omitted, the editor creates and disposes its own (previouslyQuillEditor.basicallocated new ones on every build and never disposed them). UseQuillEditorState.focusNodefor the effective node.flutter_quill_testhelpers now read the node fromQuillRawEditor's config, and the root pubspec overridesflutter_quill_testto the local path.Test plan
flutter test(103 passing), including newtest/editor/editor_leak_test.dartwith leak tracking enabled. It reports 11notDisposedobjects against the old code and none with this change.flutter testinflutter_quill_testnotDisposedreport