From e899cc3f097f2d12f5d0c2d0c94b5441e83a2ce5 Mon Sep 17 00:00:00 2001 From: Damian Tarnawsky Date: Wed, 12 Oct 2022 12:19:02 -0700 Subject: [PATCH] Resolves issue 290: InAppBrowser will not destroy WebView after being closed (by invoking ref.close()) causing memory leaks --- src/android/InAppBrowser.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index 76dc150..e8e5689 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -536,6 +536,14 @@ public class InAppBrowser extends CordovaPlugin { dialog.dismiss(); dialog = null; } + + if (url.equals(new String("about:blank"))) { + inAppWebView.onPause(); + inAppWebView.removeAllViews(); + inAppWebView.destroyDrawingCache(); + inAppWebView.destroy(); + inAppWebView = null; + } } }); // NB: From SDK 19: "If you call methods on WebView from any thread