rive-app / rive-app/rive-android

Crash! app.rive.runtime.kotlin.core.errors.RiveException: Accessing disposed C++ object RiveArtboardRenderer.

Open
#424 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

triage
Dominant language
Kotlin
Stars
538
Forks
66
PR merge metrics
No merged PRs in 30d

Description

Steps to reproduce:
LazyColumn inside each row button with rive.
Quite fast scroll up/down for few seconds.

And we have get a this crash. We are trying to riveView?.pause()/stop - just in case. clear all references. by onRelease. listItem.onRelease = { } do dispose , don't do dispose but still get this crash.

AndroidRuntime                  E  FATAL EXCEPTION: Thread-15
                                   Process: com.letyco, PID: 27929
                                   java.lang.Throwable: 
                                   app.rive.runtime.kotlin.core.errors.RiveException: Accessing disposed C++ object RiveArtboardRenderer.
                                       app.rive.runtime.kotlin.core.NativeObject.getCppPointer(NativeObject.kt:55)
                                       app.rive.runtime.kotlin.renderers.Renderer.getWidth(Renderer.kt:215)
                                       app.rive.runtime.kotlin.renderers.RiveArtboardRenderer.resizeArtboard(RiveArtboardRenderer.kt:36)
                                       app.rive.runtime.kotlin.renderers.RiveArtboardRenderer.draw(RiveArtboardRenderer.kt:51)
InputDispatcher                 E  channel 'b67e987 com.letyco/com.letyco.MainActivity' ~ Channel is unrecoverably broken and will be disposed!

You can just create empty LazaColumn. So I've added just empty RiveAnimationView and there no crash and only I uncomment. resId = style.type.resId, I've got crash by fast scroll. I event disabled rive VM. so there only empty view.
Also trying dispose in many ways this view but still get the crash.

        AndroidView(
            modifier = modifier,
            factory = { context ->

                val riveView = RiveAnimationView(context).apply {
                    // setRiveResource(
                    //     resId = style.type.resId,
                    //     // fit = Fit.LAYOUT,
                    //     stateMachineName = "boost-animation",
                    //     autoplay = false,
                    //     autoBind = false,
                    // )
                    // riveController.init(this, model)
                }
                riveView

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the crash with an empty RiveAnimationView in a rapidly scrolling LazyColumn, then trace the stack through NativeObject.kt, Renderer.kt, and RiveArtboardRenderer.kt. Determine why drawing or resizing reaches a disposed RiveArtboardRenderer and verify that rapid scrolling no longer produces the reported exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.