From 48b219d10b4c56b04f55bd04570b67a2122f4948 Mon Sep 17 00:00:00 2001 From: vojtasmrcek Date: Mon, 18 Jul 2022 10:34:56 +0200 Subject: [PATCH] Make sure we clear all the views onDestroy --- .../org/wordpress/aztec/placeholders/PlaceholderManager.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/media-placeholders/src/main/java/org/wordpress/aztec/placeholders/PlaceholderManager.kt b/media-placeholders/src/main/java/org/wordpress/aztec/placeholders/PlaceholderManager.kt index 7e940ea7e..457dad818 100644 --- a/media-placeholders/src/main/java/org/wordpress/aztec/placeholders/PlaceholderManager.kt +++ b/media-placeholders/src/main/java/org/wordpress/aztec/placeholders/PlaceholderManager.kt @@ -59,6 +59,12 @@ class PlaceholderManager( } fun onDestroy() { + positionToId.forEach { + container.findViewWithTag(it.uuid)?.let { placeholder -> + container.removeView(placeholder) + } + } + positionToId.clear() aztecText.contentChangeWatcher.unregisterObserver(this) adapters.values.forEach { it.onDestroy() } adapters.clear()