Android - Fix for webView window not being destroyed correctly causing memory leak (https://github.com/apache/cordova-plugin-inappbrowser/issues/290)

This commit is contained in:
Alessandro Basso 2021-06-16 10:34:00 -04:00
parent 2fef3046fc
commit e669dc3144

View File

@ -534,6 +534,16 @@ public class InAppBrowser extends CordovaPlugin {
dialog.dismiss();
dialog = null;
}
// Fix for webView window not being destroyed correctly causing memory leak
// (https://github.com/apache/cordova-plugin-inappbrowser/issues/290)
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