Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selecting text sometimes throws exception #185

Open
dineshnaikb opened this issue Jun 21, 2024 · 4 comments
Open

Selecting text sometimes throws exception #185

dineshnaikb opened this issue Jun 21, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@dineshnaikb
Copy link

The following _TypeError was thrown while handling a gesture:
Null check operator used on a null value

When the exception was thrown, this was the stack:
#0      SelectableRegionState._handleSelectionEndHandleDragUpdate (package:flutter/src/widgets/selectable_region.dart:839:22)
selectable_region.dart:839
#1      SelectionOverlay._handleEndHandleDragUpdate (package:flutter/src/widgets/text_selection.dart:1211:28)
text_selection.dart:1211
#2      DragGestureRecognizer._checkUpdate.<anonymous closure> (package:flutter/src/gestures/monodrag.dart:806:55)
monodrag.dart:806
#3      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:344:24)
recognizer.dart:344
#4      DragGestureRecognizer._checkUpdate (package:flutter/src/gestures/monodrag.dart:806:7)
monodrag.dart:806
#5      DragGestureRecognizer.handleEvent (package:flutter/src/gestures/monodrag.dart:652:11)
monodrag.dart:652
#6      PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:98:12)
pointer_router.dart:98
#7      PointerRouter._dispatchEventToRoutes.<anonymous closure> (package:flutter/src/gestures/pointer_router.dart:143:9)
pointer_router.dart:143
#8      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:633:13)
compact_hash.dart:633
#9      PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:141:18)
pointer_router.dart:141
#10     PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:127:7)
pointer_router.dart:127
#11     GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:495:19)
binding.dart:495
#12     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:475:22)
binding.dart:475
#13     RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:425:11)
binding.dart:425
#14     GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:420:7)
binding.dart:420
#15     GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:383:5)
binding.dart:383
#16     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:330:7)
binding.dart:330
#17     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:299:9)
binding.dart:299
#18     _invoke1 (dart:ui/hooks.dart:328:13)
hooks.dart:328

user action

trying long press and dragged the text for select and crashed

crash point


_selectionOverlay!.updateMagnifier(_buildInfoForMagnifier(
                           ^
  details.globalPosition,
  _selectionDelegate.value.endSelectionPoint!,
));

file

selectable_region.dart:839

@espresso3389

@dineshnaikb dineshnaikb changed the title select gesture Select text gesture by user in mobile Jun 21, 2024
@espresso3389 espresso3389 added the bug Something isn't working label Jun 21, 2024
@espresso3389
Copy link
Owner

This is a known issue but it is inside the Flutter code. I don't know what is the actual cause because it's too difficult to debug the issue correctly. But it seems that Flutter's text selection system does not expect scrolling/zooming of the selection coordinates.

Anyway, the exception causes selection loss but it actually causes no critical issues.

@espresso3389
Copy link
Owner

Related: #4

@espresso3389 espresso3389 changed the title Select text gesture by user in mobile Selecting text sometimes throws exception Jul 3, 2024
@espresso3389
Copy link
Owner

1.0.83 contains minor fix to make the text selection stabler.

@dineshnaikb
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants