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

Calling RS with no Context active. #222

Open
narendraanjana opened this issue Oct 3, 2024 · 3 comments
Open

Calling RS with no Context active. #222

narendraanjana opened this issue Oct 3, 2024 · 3 comments

Comments

@narendraanjana
Copy link

Please include:

  1. Library version = 2.0.2
  2. Device and OS version = Samsung Android 13
  3. Stacktrace in case of a crash
    Fatal Exception: android.renderscript.RSInvalidStateException: Calling RS with no Context active. at android.renderscript.RenderScript.validate(RenderScript.java:1241) at android.renderscript.Allocation.createFromBitmap(Allocation.java:2798) at android.renderscript.Allocation.createFromBitmap(Allocation.java:3063) at eightbitlab.com.blurview.RenderScriptBlur.blur(RenderScriptBlur.java:57) at eightbitlab.com.blurview.PreDrawBlurController.blurAndSave(PreDrawBlurController.java:168) at eightbitlab.com.blurview.PreDrawBlurController.updateBlur(PreDrawBlurController.java:118) at eightbitlab.com.blurview.PreDrawBlurController$1.onPreDraw(PreDrawBlurController.java:50) at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1124) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3854) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2618) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9971) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1010) at android.view.Choreographer.doCallbacks(Choreographer.java:809) at android.view.Choreographer.doFrame(Choreographer.java:744) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:995) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:246) at android.app.ActivityThread.main(ActivityThread.java:8653) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
@narendraanjana
Copy link
Author

Hi @Dimezis , is this issue fixed with latest version

@Dimezis
Copy link
Owner

Dimezis commented Oct 3, 2024

It's not.
It's also (most likely) not a bug in this library - something in your app is calling RenderScript.releaseAllContexts(), which destroys the RS context BlurView creates for blur.

This could be Glide's fault, for example - https://github.com/wasabeef/glide-transformations/blob/d950f0c33f27f864e4ab4b26fce66c27079911c1/transformations/src/main/java/jp/wasabeef/glide/transformations/internal/RSBlur.java#L51

So if you're using Glide, that's a likely candidate.

You can work this around by implementing your own BlurAlgorithm that delegates everything to RenderscriptBlur, try-catches the blur and recreates the RenderscriptBlur if something killed the context.

@M-Khay
Copy link

M-Khay commented Oct 3, 2024

Hello Dimezis, yes you are right, when im not using wasabeef glide transformation, this issue does not comes.

And can you please explain this with some code.

"you can work this around by implementing your own BlurAlgorithm that delegates everything to RenderscriptBlur, try-catches the blur and recreates the RenderscriptBlur if something killed the context."

it be really helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants