Skip to content

Commit ae0d8f6

Browse files
fix(android): Fix for webView window not being destroyed correctly causing memory leak (bug apache#290)
1 parent 1718efa commit ae0d8f6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/android/InAppBrowser.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,16 @@ public void onPageFinished(WebView view, String url) {
534534
dialog.dismiss();
535535
dialog = null;
536536
}
537+
538+
// Fix for webView window not being destroyed correctly causing memory leak
539+
// (https://github.com/apache/cordova-plugin-inappbrowser/issues/290)
540+
if (url.equals(new String("about:blank"))) {
541+
inAppWebView.onPause();
542+
inAppWebView.removeAllViews();
543+
inAppWebView.destroyDrawingCache();
544+
inAppWebView.destroy();
545+
inAppWebView = null;
546+
}
537547
}
538548
});
539549
// NB: From SDK 19: "If you call methods on WebView from any thread

0 commit comments

Comments
 (0)