Fixes OOM bitmap crash.
Change-Id: Ied0293b7f1dbfe16c3517dbb9e2b19c8030d31a5
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index 786e376..b951306 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -1396,6 +1396,14 @@
* Destroy the tab's main WebView and subWindow if any
*/
void destroy() {
+ if (mScreenShot != null) {
+ mScreenShot.recycle();
+ mScreenShot = null;
+ }
+ if (mCapture != null ) {
+ mCapture.recycle();
+ mCapture = null;
+ }
if (mPostponeDestroy) {
mShouldDestroy = true;
return;
@@ -2024,6 +2032,10 @@
int state = c.save();
float scale = 0;
Bitmap screenShot = mMainView.getViewportBitmap();
+ if (mScreenShot != null) {
+ mScreenShot.recycle();
+ mScreenShot = null;
+ }
mScreenShot = screenShot;
if (screenShot != null) {
//scale based on device orientation