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

Commit 7883c975 authored by Romain Guy's avatar Romain Guy
Browse files

Prevent crash in Dialog.

Bug #2249637
parent fb9f10f6
Loading
Loading
Loading
Loading
+7 −19
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Config;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextThemeWrapper;
@@ -72,8 +71,6 @@ import java.lang.ref.WeakReference;
 */
public class Dialog implements DialogInterface, Window.Callback,
        KeyEvent.Callback, OnCreateContextMenuListener {
    private static final String LOG_TAG = "Dialog";

    private Activity mOwnerActivity;
    
    final Context mContext;
@@ -104,6 +101,12 @@ public class Dialog implements DialogInterface, Window.Callback,
    private final Thread mUiThread;
    private final Handler mHandler = new Handler();

    private static final int DISMISS = 0x43;
    private static final int CANCEL = 0x44;
    private static final int SHOW = 0x45;

    private Handler mListenersHandler;

    private final Runnable mDismissAction = new Runnable() {
        public void run() {
            dismissDialog();
@@ -213,8 +216,6 @@ public class Dialog implements DialogInterface, Window.Callback,
     */
    public void show() {
        if (mShowing) {
            if (Config.LOGV) Log.v(LOG_TAG,
                    "[Dialog] start: already showing, ignore");
            if (mDecor != null) {
                mDecor.setVisibility(View.VISIBLE);
            }
@@ -266,14 +267,7 @@ public class Dialog implements DialogInterface, Window.Callback,
    }

    private void dismissDialog() {
        if (mDecor == null) {
            if (Config.LOGV) Log.v(LOG_TAG,
                    "[Dialog] dismiss: already dismissed, ignore");
            return;
        }
        if (!mShowing) {
            if (Config.LOGV) Log.v(LOG_TAG,
                    "[Dialog] dismiss: not showing, ignore");
        if (mDecor == null || !mShowing || mDecor.getWindowToken() == null) {
            return;
        }

@@ -1034,12 +1028,6 @@ public class Dialog implements DialogInterface, Window.Callback,
        mOnKeyListener = onKeyListener;
    }

    private static final int DISMISS = 0x43;
    private static final int CANCEL = 0x44;
    private static final int SHOW = 0x45;

    private Handler mListenersHandler;

    private static final class ListenersHandler extends Handler {
        private WeakReference<DialogInterface> mDialog;

+5 −0
Original line number Diff line number Diff line
@@ -40,6 +40,11 @@ import android.view.View.OnFocusChangeListener;
 * handler, and manage callbacks. You might call this object to iterate the list
 * of tabs, or to tweak the layout of the tab list, but most methods should be
 * called on the containing TabHost object.
 * 
 * @attr ref android.R.styleable#TabWidget_divider
 * @attr ref android.R.styleable#TabWidget_stripEnabled
 * @attr ref android.R.styleable#TabWidget_stripLeft
 * @attr ref android.R.styleable#TabWidget_stripRight
 */
public class TabWidget extends LinearLayout implements OnFocusChangeListener {
    private OnTabSelectionChanged mSelectionChangedListener;