File tree Expand file tree Collapse file tree
super_editor/lib/src/default_editor/document_ime Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -98,13 +98,18 @@ class _ImeFocusPolicyState extends State<ImeFocusPolicy> {
9898
9999 @override
100100 void dispose () {
101+ _focusNode.removeListener (_onFocusChange);
101102 if (widget.focusNode == null ) {
102103 _focusNode.dispose ();
103104 }
104105 super .dispose ();
105106 }
106107
107108 void _onFocusChange () {
109+ if (! mounted) {
110+ return ;
111+ }
112+
108113 if (_focusNode.hasFocus && ! SuperIme .instance.isOwner (widget.inputId)) {
109114 // We have focus but we don't own the IME. Take it over.
110115 SuperIme .instance.takeOwnership (widget.inputId);
@@ -416,7 +421,6 @@ class _DocumentSelectionOpenAndCloseImePolicyState extends State<DocumentSelecti
416421
417422 if (! _wasAttached || SuperIme .instance.isInputAttachedToOS (widget.inputId)) {
418423 // We didn't go from closed to open. Our policy doesn't apply.
419-
420424 return ;
421425 }
422426
You can’t perform that action at this time.
0 commit comments