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

Commit c0b778e1 authored by Leon Clarke's avatar Leon Clarke
Browse files
Create a concept of blocking messages on destruction similar to that in
WebViewCore.java. This is to prevent what I think is a race condition
caused by an orientation event occuring just before the frame is destroyed,
resulting in the orientation listener being called back just before it
is disabled, but posting its message after the messages have been removed.
This results in the orientation event being delivered to a NULL native frame.
parent 2c62f5f4
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -62,6 +62,10 @@ class BrowserFrame extends Handler {
    private int mLoadType;
    private boolean mFirstLayoutDone = true;
    private boolean mCommitted = true;
    // Flag for blocking messages. This is used during destroy() so
    // that if the UI thread posts any messages after the message
    // queue has been cleared,they are ignored.
    private boolean mBlockMessages = false;

    // Is this frame the main frame?
    private boolean mIsMainFrame;
@@ -383,6 +387,7 @@ class BrowserFrame extends Handler {
    public void destroy() {
        mOrientationListener.disable();
        nativeDestroyFrame();
        mBlockMessages = true;
        removeCallbacksAndMessages(null);
    }

@@ -392,6 +397,9 @@ class BrowserFrame extends Handler {
     */
    @Override
    public void handleMessage(Message msg) {
        if (mBlockMessages) {
            return;
        }
        switch (msg.what) {
            case FRAME_COMPLETED: {
                if (mSettings.getSavePassword() && hasPasswordField()) {