From 594e303cd789c26037b77558ae6a017fcc074b23 Mon Sep 17 00:00:00 2001 From: lisonge Date: Fri, 17 Nov 2023 18:50:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=97=A0=E9=9A=9C=E7=A2=8D=E6=88=AA?= =?UTF-8?q?=E5=B1=8F=E8=B5=84=E6=BA=90=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/li/songe/gkd/service/GkdAbService.kt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/li/songe/gkd/service/GkdAbService.kt b/app/src/main/java/li/songe/gkd/service/GkdAbService.kt index d5a49cc04..745aaf68a 100644 --- a/app/src/main/java/li/songe/gkd/service/GkdAbService.kt +++ b/app/src/main/java/li/songe/gkd/service/GkdAbService.kt @@ -330,11 +330,15 @@ class GkdAbService : CompositionAbService({ application.mainExecutor, object : TakeScreenshotCallback { override fun onSuccess(screenshot: ScreenshotResult) { - it.resume( - Bitmap.wrapHardwareBuffer( - screenshot.hardwareBuffer, screenshot.colorSpace + try { + it.resume( + Bitmap.wrapHardwareBuffer( + screenshot.hardwareBuffer, screenshot.colorSpace + ) ) - ) + } finally { + screenshot.hardwareBuffer.close() + } } override fun onFailure(errorCode: Int) = it.resume(null)