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

RiveRenderObject._toArtboard throws error #355

Closed
kaptnkoala opened this issue Nov 27, 2023 · 1 comment
Closed

RiveRenderObject._toArtboard throws error #355

kaptnkoala opened this issue Nov 27, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@kaptnkoala
Copy link

Description

We see many errors in our crash reporting tools, that RiveRenderObject._toArtboard is throwing an error, when it tries to handle a pointer event and is not anymore attached to the render tree. We can not reproduce the error in a local debug build, but this has become the biggest cluster of errors for our release apps. I have attached the full stack trace in the additional context section.

Probably the issues would be relatively easy to solve, when the handleEvent method would also check, if the RenderObject is still attached before handling the received event like this:

  @override
  void handleEvent(PointerEvent event, HitTestEntry entry) {
    assert(debugHandleEvent(event, entry));
    if (!enableHitTests || !attached) {
      return;
    }    
  }

Expected behavior

The code should contain a safeguard condition, that prevents that events are tried to be handle on an unattached instance of the RiveRenderObject.

Device & Versions (please complete the following information)

  • Device: Mostly iOS devices
  • Flutter Version:
Flutter 3.13.8 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 6c4930c4ac (6 weeks ago) • 2023-10-18 10:57:55 -0500
Engine • revision 767d8c75e8
Tools • Dart 3.1.4 • DevTools 2.25.0

Additional context

_TypeError: Null check operator used on a null value
  File "object.dart", line 3255, in RenderObject.getTransformTo
  File "box.dart", line 2612, in RenderBox.localToGlobal
  File "rive.dart", line 141, in RiveRenderObject._toArtboard
  File "rive.dart", line 148, in RiveRenderObject._hitHelper
  File "rive.dart", line 177, in RiveRenderObject.handleEvent
  File "binding.dart", line 468, in GestureBinding.dispatchEvent
  File "binding.dart", line 333, in RendererBinding.dispatchEvent
  File "binding.dart", line 413, in GestureBinding._handlePointerEventImmediately
  File "binding.dart", line 376, in GestureBinding.handlePointerEvent
  File "binding.dart", line 323, in GestureBinding._flushPointerEventQueue
  File "binding.dart", line 292, in GestureBinding._handlePointerDataPacket
  File "hooks.dart", line 186, in _invoke1
  File "platform_dispatcher.dart", line 424, in PlatformDispatcher._dispatchPointerDataPacket
  File "hooks.dart", line 119, in _dispatchPointerDataPacket
@kaptnkoala kaptnkoala added the bug Something isn't working label Nov 27, 2023
@HayesGordon
Copy link
Contributor

Hi @kaptnkoala, we'll get this added in the next release. Thanks for reporting and suggesting a fix

rive-engineering pushed a commit that referenced this issue Jan 11, 2024
Fixes #355

Diffs=
cfe49a60b fix: validate attached state before handling pointer events (#6439)
dcbe806b0 default to skia branch for commit hash in cache helper (#6432)

Co-authored-by: Gordon <pggordonhayes@gmail.com>
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