Skip to content

Commit e52a12e

Browse files
committed
2 fixes
Fix crash when pausing/resuming application after closing InAppBrowser Whenever closing an InAppBrowser instance, a webview was left in memory with about:blank page. This change fixes the issue by destroying and freeing the inAppWebView object.
1 parent 32dba94 commit e52a12e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/android/InAppBrowser.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ public void onReset() {
352352
*/
353353
@Override
354354
public void onPause(boolean multitasking) {
355-
if (shouldPauseInAppBrowser) {
355+
if (shouldPauseInAppBrowser && inAppWebView != null) {
356356
inAppWebView.onPause();
357357
}
358358
}
@@ -362,7 +362,7 @@ public void onPause(boolean multitasking) {
362362
*/
363363
@Override
364364
public void onResume(boolean multitasking) {
365-
if (shouldPauseInAppBrowser) {
365+
if (shouldPauseInAppBrowser && inAppWebView != null) {
366366
inAppWebView.onResume();
367367
}
368368
}
@@ -534,6 +534,13 @@ public void onPageFinished(WebView view, String url) {
534534
dialog.dismiss();
535535
dialog = null;
536536
}
537+
if (url.equals("about:blank")) {
538+
inAppWebView.onPause();
539+
inAppWebView.removeAllViews();
540+
inAppWebView.destroyDrawingCache();
541+
inAppWebView.destroy();
542+
inAppWebView = null;
543+
}
537544
}
538545
});
539546
// NB: From SDK 19: "If you call methods on WebView from any thread

0 commit comments

Comments
 (0)