diff --git a/leakcanary/leakcanary-android-core/src/main/java/leakcanary/internal/activity/screen/RenderHeapDumpScreen.kt b/leakcanary/leakcanary-android-core/src/main/java/leakcanary/internal/activity/screen/RenderHeapDumpScreen.kt index b5bc7d03f3..09a62d5ee7 100644 --- a/leakcanary/leakcanary-android-core/src/main/java/leakcanary/internal/activity/screen/RenderHeapDumpScreen.kt +++ b/leakcanary/leakcanary-android-core/src/main/java/leakcanary/internal/activity/screen/RenderHeapDumpScreen.kt @@ -46,7 +46,10 @@ internal class RenderHeapDumpScreen( viewTreeObserver.addOnGlobalLayoutListener(object : OnGlobalLayoutListener { override fun onGlobalLayout() { - + // Extract values from the main thread, these could change by the time + // we get to the IO thread. + val measuredWidth = measuredWidth + val measuredHeight = measuredHeight executeOnIo { val bitmap = HeapDumpRenderer.render( context, heapDumpFile, measuredWidth, measuredHeight, 0