TonicArtos / StickyGridHeaders

This project has been superseded by SuperSLiM, a layout manager for RecyclerView. I strongly recommend using SuperSLiM and not StickyGridHeaders.
http://tonicartos.com
Apache License 2.0
1.47k stars 442 forks source link

Recycled bitmap exception #44

Closed pablojacobi closed 11 years ago

pablojacobi commented 11 years ago

Hi!

I have been using your StickyGridHeaders for a while, and I have now 1.000 or 2.000 users. When they open the gridview with headers randomly app crashes because of:

java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@406b64a8 1
at android.graphics.Canvas.throwIfRecycled(Canvas.java:955) 2
at android.graphics.Canvas.drawBitmap(Canvas.java:1044) 3
at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:325) 4
at android.widget.ImageView.onDraw(ImageView.java:872) 5
at android.view.View.draw(View.java:6933) 6
at android.view.ViewGroup.drawChild(ViewGroup.java:1646) 7
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) 8
at android.view.View.draw(View.java:6936) 9
at android.widget.FrameLayout.draw(FrameLayout.java:357) 10
at android.view.ViewGroup.drawChild(ViewGroup.java:1646) 11
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) 12
at android.view.ViewGroup.drawChild(ViewGroup.java:1644) 13
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) 14
at android.view.ViewGroup.drawChild(ViewGroup.java:1644) 15
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) 16
at android.view.View.buildDrawingCache(View.java:6693) 17
at android.view.View.getDrawingCache(View.java:6481) 18
at android.view.ViewGroup.drawChild(ViewGroup.java:1571) 19
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373) 20
at android.widget.AbsListView.dispatchDraw(AbsListView.java:1627) 21
at android.widget.GridView.dispatchDraw(GridView.java:1943) 22
at com.tonicartos.widget.stickygridheaders.StickyGridHeadersGridView.dispatchDraw(StickyGridHeadersGridView.java:689)

It happens about 1% of the times. I don't want to remove recycles because it's bad for memory usage.

Thanks in advance,

Regards

TonicArtos commented 11 years ago

Hi Pablo, can you please update to HEAD on master and confirm if the error still occurs.

TonicArtos commented 11 years ago

Taking a closer look at your trace I am pretty sure this is a symptom of the same bug that caused #30, which has been fixed.

pablojacobi commented 11 years ago

Cool, I just updated the library, if I have an issue again I'll tell you :) Thanks!

TonicArtos commented 11 years ago

That's great! I am going to close this issue for now, but if you have the problem again please open this issue again and post another trace. Thanks. :)