Skip to content

Commit

Permalink
fix(android): Fix for webView window not being destroyed correctly ca…
Browse files Browse the repository at this point in the history
…using memory leak (bug apache#290)
  • Loading branch information
jeansparipassu committed Nov 8, 2021
1 parent 1718efa commit ae0d8f6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/android/InAppBrowser.java
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,16 @@ public void onPageFinished(WebView view, String url) {
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
Expand Down

0 comments on commit ae0d8f6

Please sign in to comment.