Merge "Prevent serialization after being destroyed"

This commit is contained in:
John Reck
2011-09-01 13:48:42 -07:00
committed by Android (Google) Code Review
2 changed files with 8 additions and 1 deletions

View File

@@ -36,11 +36,15 @@ class ViewStateSerializer {
static boolean serializeViewState(OutputStream stream, WebView web) static boolean serializeViewState(OutputStream stream, WebView web)
throws IOException { throws IOException {
int baseLayer = web.getBaseLayer();
if (baseLayer == 0) {
return false;
}
DataOutputStream dos = new DataOutputStream(stream); DataOutputStream dos = new DataOutputStream(stream);
dos.writeInt(VERSION); dos.writeInt(VERSION);
dos.writeInt(web.getContentWidth()); dos.writeInt(web.getContentWidth());
dos.writeInt(web.getContentHeight()); dos.writeInt(web.getContentHeight());
return nativeSerializeViewState(web.getBaseLayer(), dos, return nativeSerializeViewState(baseLayer, dos,
new byte[WORKING_STREAM_STORAGE]); new byte[WORKING_STREAM_STORAGE]);
} }

View File

@@ -4308,6 +4308,9 @@ public class WebView extends AbsoluteLayout
} }
int getBaseLayer() { int getBaseLayer() {
if (mNativeClass == 0) {
return 0;
}
return nativeGetBaseLayer(); return nativeGetBaseLayer();
} }