OSDN Git Service

GlobalAction dialog ref not set to null
authorHenrik Baard <henrik.baard@sonymobile.com>
Tue, 23 Jul 2013 07:31:57 +0000 (09:31 +0200)
committerHenrik Baard <henrik.baard@sonymobile.com>
Wed, 7 Aug 2013 10:02:30 +0000 (12:02 +0200)
When a GlobalAction dialog is dismissed when screen goes into
sleep the reference mDialog is not set to null. Next time the
long presses power button and brings up the GlobalAction dialog
the old reference still exist and we try to dismiss the dialog
again even if it does not exist.

The dialog reference in this case holds on to the dialog object
using more memory than neccesary, and in rare cases we might get
a crash when the dialog object is dissmissed the second time.

Change-Id: I44ef1c385d90777e8f6dd9fe111eb3d9b0d3cf3f

policy/src/com/android/internal/policy/impl/GlobalActions.java

index a2ac8fe..b978863 100644 (file)
@@ -879,6 +879,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
             case MESSAGE_DISMISS:
                 if (mDialog != null) {
                     mDialog.dismiss();
+                    mDialog = null;
                 }
                 break;
             case MESSAGE_REFRESH: