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

App Crash when setting same bitmap again. #545

Open
mostafaimran opened this issue Feb 17, 2021 · 3 comments
Open

App Crash when setting same bitmap again. #545

mostafaimran opened this issue Feb 17, 2021 · 3 comments

Comments

@mostafaimran
Copy link

mostafaimran commented Feb 17, 2021

Please provide as much of the following information as possible. Please do not raise issues to ask for help developing your app.

Expected behaviour

App should not crash.

Actual behaviour

App crashes when setting same bitmap again. Setting the bitmap first time works perfectly but setting the bitmap again crashes.

Steps to reproduce

Set same bitmap again and crash happens. Crash happens in this line -
SubsamplingScaleImageView.onDraw(SubsamplingScaleImageView.java:1111)

(Include your setup code, and where relevant, your layout XML)

Affected devices

Pixel 2

(Specific devices, screen densities, SDK versions)

Affected images

(Attach images you have problems with)

Crash log --
native: #186 pc 0000000000547e50 /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeWithVarArgsart::ArtMethod*(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, std::__va_list)+448)
runtime.cc:655] native: #187 pc 000000000054830c /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeWithVarArgs<_jmethodID*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+92)
runtime.cc:655] native: #188 pc 0000000000431e24 /apex/com.android.art/lib64/libart.so (art::JNI::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+636)
runtime.cc:655] native: #189 pc 0000000000099428 /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+124)
runtime.cc:655] native: #190 pc 00000000000a0880 /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vectorandroid::String8 const&, bool)+836)
runtime.cc:655] native: #191 pc 0000000000003574 /system/bin/app_process64 (main+1324)
runtime.cc:655] native: #192 pc 000000000004973c /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+108)
runtime.cc:655] at android.graphics.BaseRecordingCanvas.nDrawBitmapMatrix(Native method)
runtime.cc:655] at android.graphics.BaseRecordingCanvas.drawBitmap(BaseRecordingCanvas.java:78)
runtime.cc:655] at com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.onDraw(SubsamplingScaleImageView.java:1111)
runtime.cc:655] at com.cloudapper.android.custom.customviews.layoutmap.LayoutMapView.onDraw(LayoutMapView.kt:791)
runtime.cc:655] at android.view.View.draw(View.java:22350)
runtime.cc:655] at android.view.View.updateDisplayListIfDirty(View.java:21226)
runtime.cc:655] at android.view.View.draw(View.java:22081)
runtime.cc:655] at android.view.ViewGroup.drawChild(ViewGroup.java:4516)
runtime.cc:655] at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4277)
runtime.cc:655] at android.view.View.updateDisplayListIfDirty(View.java:21217)
runtime.cc:655] at android.view.View.draw(View.java:22081)
runtime.cc:655] at android.view.ViewGroup.drawChild(ViewGroup.java:4516)
runtime.cc:655] at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4277)
runtime.cc:655] at android.view.View.updateDisplayListIfDirty(View.java:21217)
runtime.cc:655] at android.view.View.draw(View.java:22081)
runtime.cc:655] at android.view.ViewGroup.drawChild(ViewGroup.java:4516)
runtime.cc:655] at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4277)
runtime.cc:655] at android.view.View.updateDisplayListIfDirty(View.java:21217)
runtime.cc:655] at android.view.View.draw(View.java:22081)
runtime.cc:655] at android.view.ViewGroup.drawChild(ViewGroup.java:4516)
runtime.cc:655] at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4277)
runtime.cc:655] at android.view.View.draw(View.java:22353)
runtime.cc:655] at android.view.View.updateDisplayListIfDirty(View.java:21226)
runtime.cc:655] at android.view.View.draw(View.java:22081)
runtime.cc:655] at android.view.ViewGroup.drawChild(ViewGroup.java:4516)
runtime.cc:655] at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4277)
runtime.cc:655] at android.view.View.updateDisplayListIfDirty(View.java:21217)
runtime.cc:655] at android.view.View.draw(View.java:22081)
runtime.cc:655] at android.view.ViewGroup.drawChild(ViewGroup.java:4516)
runtime.cc:655] at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4277)
runtime.cc:655] at android.view.View.updateDisplayListIfDirty(View.java:21217)
runtime.cc:655] at android.view.View.draw(View.java:22081)
runtime.cc:655] at android.view.ViewGroup.drawChild(ViewGroup.java:4516)
runtime.cc:655] at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4277)
runtime.cc:655] at android.view.View.draw(View.java:22353)
runtime.cc:655] at androidx.core.widget.NestedScrollView.draw(NestedScrollView.java:1998)

@MarekMacko
Copy link

Any update?

@mostafaimran
Copy link
Author

I did a workaround to overcome this crash when need to update the view with resetting the bitmap. Each time I am removing and then adding the view to a FrameLayout when I need to update the view with new bitmap.

@davemorrissey
Copy link
Owner

You haven't provided your source so I don't know if you're using ImageSource.cachedBitmap to avoid recycling - but the view shouldn't try to draw a recycled bitmap so I assume you are. If so, I don't see how I could fix this because the crash is deep in native code and all the view does is draw the bitmap it's given.

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