Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 90afe21d authored by John Reck's avatar John Reck
Browse files

Prevent serialization after being destroyed

 Bug: 5246900

Change-Id: Ic0be139b26e1b52203b8d0286c12175df6a1a46c
parent 6c859576
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -36,11 +36,15 @@ class ViewStateSerializer {

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

+3 −0
Original line number Diff line number Diff line
@@ -4311,6 +4311,9 @@ public class WebView extends AbsoluteLayout
    }

    int getBaseLayer() {
        if (mNativeClass == 0) {
            return 0;
        }
        return nativeGetBaseLayer();
    }