From 555c18ae4fa333baaee6edd8b4babc6ae753e9a4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 17 Dec 2018 21:14:28 +0100 Subject: [PATCH] close the inputStream after using at the editor activity --- .../simplemobiletools/gallery/pro/activities/EditActivity.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt index ee4d4afd1..8ee45eacb 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt @@ -593,14 +593,17 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener bitmap.compress(file.absolutePath.getCompressionFormat(), 90, out) } + var inputStream: InputStream? = null try { if (isNougatPlus()) { - val inputStream = contentResolver.openInputStream(uri) + inputStream = contentResolver.openInputStream(uri) val oldExif = ExifInterface(inputStream) val newExif = ExifInterface(file.absolutePath) oldExif.copyTo(newExif, false) } } catch (e: Exception) { + } finally { + inputStream?.close() } setResult(Activity.RESULT_OK, intent)