From 6e40cf99a949ee5239ae0814f09d3b98d1795e50 Mon Sep 17 00:00:00 2001 From: Woody Hayday Date: Fri, 13 Jun 2025 13:31:04 +0100 Subject: [PATCH] Proposed fix for issue where closeConnectionIfNeeded() was initiating a _markNeedsBuild() during dispose, causing exception --- lib/src/editor/raw_editor/raw_editor_state.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/src/editor/raw_editor/raw_editor_state.dart b/lib/src/editor/raw_editor/raw_editor_state.dart index 98905c2b3..516d32db7 100644 --- a/lib/src/editor/raw_editor/raw_editor_state.dart +++ b/lib/src/editor/raw_editor/raw_editor_state.dart @@ -960,6 +960,10 @@ class QuillRawEditorState extends EditorState @override void dispose() { + if (!widget.config.readOnly) { + widget.config.focusNode.removeListener(_handleFocusChanged); + composingRange.removeListener(_onComposingRangeChanged); + } closeConnectionIfNeeded(); _keyboardVisibilitySubscription?.cancel(); HardwareKeyboard.instance.removeHandler(_hardwareKeyboardEvent); @@ -967,10 +971,6 @@ class QuillRawEditorState extends EditorState _selectionOverlay?.dispose(); _selectionOverlay = null; controller.removeListener(_didChangeTextEditingValueListener); - if (!widget.config.readOnly) { - widget.config.focusNode.removeListener(_handleFocusChanged); - composingRange.removeListener(_onComposingRangeChanged); - } _cursorCont.dispose(); if (_clipboardStatus != null) { _clipboardStatus!