Recycled bitmap exception #3

Closed
bostone opened this Issue Jan 28, 2013 · 3 comments

3 participants

@bostone

Since I'm not forcing recycle() anywhere in my code I assume that it is BitmapCache that is responsible

Here's the full stack trace

java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@406c13e
at android.graphics.Canvas.throwIfRecycled(Canvas.java:965)
at android.graphics.Canvas.drawBitmap(Canvas.java:1054)
at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:325)
at android.widget.ImageView.onDraw(ImageView.java:854)
at android.view.View.draw(View.java:6889)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.widget.AbsListView.dispatchDraw(AbsListView.java:1485)
at android.widget.ListView.dispatchDraw(ListView.java:3138)
at android.view.View.draw(View.java:7011)
at android.widget.AbsListView.draw(AbsListView.java:2593)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6892)
at android.widget.FrameLayout.draw(FrameLayout.java:357)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at com.slidingmenu.lib.CustomViewAbove.dispatchDraw(CustomViewAbove.java:845)
at android.view.View.draw(View.java:6892)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6892)
at android.widget.FrameLayout.draw(FrameLayout.java:357)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6892)
at android.widget.FrameLayout.draw(FrameLayout.java:357)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1895)
at android.view.ViewRoot.draw(ViewRoot.java:1524)
at android.view.ViewRoot.performTraversals(ViewRoot.java:1260)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1864)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3695)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
at dalvik.system.NativeStart.main(Native Method)
java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@406d717
at android.graphics.Canvas.throwIfRecycled(Canvas.java:965)
at android.graphics.Canvas.drawBitmap(Canvas.java:1054)
at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:325)
at android.widget.ImageView.onDraw(ImageView.java:854)
at android.view.View.draw(View.java:6889)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.widget.AbsListView.dispatchDraw(AbsListView.java:1485)
at android.widget.ListView.dispatchDraw(ListView.java:3138)
at android.view.View.draw(View.java:7011)
at android.widget.AbsListView.draw(AbsListView.java:2593)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6892)
at android.widget.FrameLayout.draw(FrameLayout.java:357)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at com.slidingmenu.lib.CustomViewAbove.dispatchDraw(CustomViewAbove.java:845)
at android.view.View.draw(View.java:6892)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6892)
at android.widget.FrameLayout.draw(FrameLayout.java:357)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6892)
at android.widget.FrameLayout.draw(FrameLayout.java:357)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1895)
at android.view.ViewRoot.draw(ViewRoot.java:1524)
at android.view.ViewRoot.performTraversals(ViewRoot.java:1260)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1864)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3695)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
at dalvik.system.NativeStart.main(Native Method)

@g123k

Same problem here :/

@chrisbanes chrisbanes added a commit that referenced this issue Jan 31, 2013
@chrisbanes Fix #3 6efa586
@chrisbanes chrisbanes closed this Jan 31, 2013
@bostone

As an idea - it would be great to have a way to disable call to recycle() all together. Fo example in my case I don't have high volume of images so I'm sure that the app will perform fine with regular GC.

@chrisbanes
Owner

@bostone: Added in 0b513f5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment