Skip to content

Commit

Permalink
Update InAppBrowser.java
Browse files Browse the repository at this point in the history
Fix for webView window not being destroyed correctly causing memory leak (apache/cordova-plugin-inappbrowser#290)
  • Loading branch information
ralphcode authored Aug 31, 2023
1 parent 5e56e0a commit e7c001e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/android/InAppBrowser.java
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,15 @@ 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("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 e7c001e

Please sign in to comment.