Skip to content

[iOS] StateError painting.dart in Path.combine in _RenderCupertinoTextSelectionToolbarShape #110076

@zddarova

Description

@zddarova

Hi, I'm faced with an Exception that was reported in Sentry and I'm not sure what could be the cause, how to fix it, or reproduce it.

This issue is related to text selection on iOS. It is rare and affects a few users, but generates a lot of errors coz this is probably a UI bug and it throws an error every time the screen repaints.
It started a year ago when flutter was updated to the 2nd version and does not depends on the device model or ios version.
I tried to enable some accessibility settings (bold text, high contrast, zoom) but had no luck in reproducing it.
I think, this is a Flutter issue, but I have not found any similar threads in the Flutter repo and have no steps to reproduce.

In this screen, I'm using SelectableText widget and TextField, but I'm not sure, which could throw this error,

Issue caused file is text_selection.dart from Cupertino library.
Class is _RenderCupertinoTextSelectionToolbarShape
Method _clipPath, Path.combine call, line 284.

Logs

Error and stack trace:

StateError: Bad state: Path.combine() failed.  This may be due an invalid path; in particular, check for NaN values.
  File "painting.dart", line 2616, in Path.combine
  File "text_selection_toolbar.dart", line 284, in _RenderCupertinoTextSelectionToolbarShape._clipPath
  File "text_selection_toolbar.dart", line 298, in _RenderCupertinoTextSelectionToolbarShape.paint
  File "object.dart", line 2449, in RenderObject._paintWithContext
  File "object.dart", line 141, in PaintingContext._repaintCompositedChild
  File "object.dart", line 100, in PaintingContext.repaintCompositedChild
  File "object.dart", line 995, in PipelineOwner.flushPaint
  File "binding.dart", line 499, in RendererBinding.drawFrame
  File "binding.dart", line 883, in WidgetsBinding.drawFrame
  File "binding.dart", line 363, in RendererBinding._handlePersistentFrameCallback
  File "binding.dart", line 1144, in SchedulerBinding._invokeFrameCallback
  File "binding.dart", line 1081, in SchedulerBinding.handleDrawFrame
  File "binding.dart", line 995, in SchedulerBinding._handleDrawFrame
  File "zone.dart", line 1426, in _rootRun
  File "zone.dart", line 1328, in _CustomZone.run
  File "zone.dart", line 1236, in _CustomZone.runGuarded
  File "hooks.dart", line 151, in _invoke
  File "platform_dispatcher.dart", line 308, in PlatformDispatcher._drawFrame
  File "hooks.dart", line 115, in _drawFrame

Flutter doctor output:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.5, on macOS 12.5.1 21G83 darwin-arm, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.70.2)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

I would appreciate any help with it, tips, or suggestion on how it could be reproduced or fixed.

Metadata

Metadata

Labels

P1High-priority issues at the top of the work lista: productionIssues experienced in live production appsa: text inputEntering text in a text field or keyboard related problemsc: crashStack traces logged to the consolef: cupertinoflutter/packages/flutter/cupertino repositoryframeworkflutter/packages/flutter repository. See also f: labels.platform-iosiOS applications specificallyteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions