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

Fix crashing issue when total vertical padding is larger than the View's height #39

Conversation

h6ah4i
Copy link
Contributor

@h6ah4i h6ah4i commented Sep 4, 2021

Hi. I noticed that AndroidFastScroll can cause weird app crashing in a certain situation.

The crash log message

Here's the extracted message from the Logcat when my app crashed.

I can see an error occurred in the RenderThread thread and someone trying to create a negative height (-196 px) View.

A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 5715 (RenderThread), pid 5581 (***)
Abort message: 'JNI DETECTED ERROR IN APPLICATION: JNI CallVoidMethodV called with pending exception java.lang.IllegalStateException: Unable to create layer for View, size 64x-192 max size 16384 color type 4 has context 1
    (Throwable with empty stack trace)    

Investigation result

When FastScroller attached view's height is smaller than its total vertical padding, the track view created in FastScroller will be requested to layout with inappropriate coordinates.

Proposed fix

Cramping the bottom position value with the top position value not to request negative height when layout the track view.

@h6ah4i h6ah4i changed the title Fix crashing issue when total vertical padding is larger than View's height Fix crashing issue when total vertical padding is larger than the View's height Sep 4, 2021
@zhanghai
Copy link
Owner

Thanks for the fix and sorry I somehow forgot to take a look at this!

However, you will need to sign the CLA before I can merge this PR. If you don't want the trouble, I can also just go ahead and fix it myself. What do you think?

@h6ah4i
Copy link
Contributor Author

h6ah4i commented Apr 26, 2022

@zhanghai Hi. Thank you for your response 👍

I think I have already signed the Google Individual Contributor License Agreement, can you confirm my agreement status?

image

@zhanghai
Copy link
Owner

Cool! I'll merge the fix, thanks!

@zhanghai zhanghai merged commit 56bb28f into zhanghai:master Apr 26, 2022
@h6ah4i h6ah4i deleted the fix/crash-due-to-requesting-negative-height-view-layout branch May 21, 2022 00:43
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

Successfully merging this pull request may close these issues.

None yet

2 participants