Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Crash from TextObjectFilterRender

Open
#1,830 7 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 2 days

@pedroSG94 is already working on this.

Since Jun 6, 2025.

Assessment

This issue has not been assessed yet.

Description

bug unable to reproduce

Hi,

I noticed a new crash that happens sometimes when i add a TextObjectFilterRender overlay. I started happening after 2.5.7. The only addition I see that could be related is the abstract void disableResources() method.
This is the exception I get:

Fatal Exception: java.lang.IllegalArgumentException: bitmap is recycled
     at android.opengl.GLUtils.texImage2D(GLUtils.java:152)
     at com.pedro.encoder.input.gl.TextureLoader.load(TextureLoader.java:41)
     at com.pedro.encoder.input.gl.render.filters.object.BaseObjectFilterRender.drawFilter(BaseObjectFilterRender.java:109)
     at com.pedro.encoder.input.gl.render.filters.object.TextObjectFilterRender.drawFilter(TextObjectFilterRender.java:48)
     at com.pedro.encoder.input.gl.render.filters.BaseFilterRender.draw(BaseFilterRender.java:72)
     at com.pedro.encoder.input.gl.render.MainRender.drawFilters(MainRender.kt:69)
     at com.pedro.library.view.GlStreamInterface.draw(GlStreamInterface.kt:280)
     at com.pedro.library.view.GlStreamInterface.onFrameAvailable$lambda$4(GlStreamInterface.kt:295)
     at com.pedro.library.view.GlStreamInterface.$r8$lambda$0B-KT4vcqgQlJR7AIT7c70zbmo0()
     at com.pedro.library.view.GlStreamInterface$$ExternalSyntheticLambda3.run(D8$$SyntheticClass)
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
     at java.lang.Thread.run(Thread.java:1012)

line 41 in TextureLoader is

GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmaps[i], 0);

I wrapped it in

        if (!bitmaps[i].isRecycled()) {
          GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmaps[i], 0);
        } else {
          GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888), 0);
        }

and the exception doesn't happen anymore. Does this look like a good fix to you? @pedroSG94

Dominant language
Kotlin
Stars
3k
Forks
946
Avg merge
4d 6h
Merged PRs (30d)
9

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from pedroSG94/RootEncoder

All issues in pedroSG94/RootEncoder

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.