diff options
author | Wu-cheng Li <wuchengli@google.com> | 2010-08-27 09:45:19 -0700 |
---|---|---|
committer | Wu-cheng Li <wuchengli@google.com> | 2010-08-29 22:29:34 -0700 |
commit | 98e0be90b938b42814d3ee34e638a3f46c06fed4 (patch) | |
tree | 3c213e80f60a169f1a34d4c896f85e1419ec3df4 /src | |
parent | 20ddc2054b04d40b4e15e0831d3df02f30b600e8 (diff) | |
download | LegacyCamera-98e0be90b938b42814d3ee34e638a3f46c06fed4.zip LegacyCamera-98e0be90b938b42814d3ee34e638a3f46c06fed4.tar.gz LegacyCamera-98e0be90b938b42814d3ee34e638a3f46c06fed4.tar.bz2 |
Fix memory leak. Camera application is leaking activities.
ComboPreferences.sMap (value)
-->ComboPreference (field mListeners)
-->HeadUpDisplay
-->activities
Make sure HeadUpDisplay is unregistered from ComboPreference
listener list.
bug:2949181
Change-Id: Ia0350afd6e9f23f92ce4b252a4b74709b4cd5bf7
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/camera/ui/HeadUpDisplay.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/com/android/camera/ui/HeadUpDisplay.java b/src/com/android/camera/ui/HeadUpDisplay.java index 0db869b..98e885e 100644 --- a/src/com/android/camera/ui/HeadUpDisplay.java +++ b/src/com/android/camera/ui/HeadUpDisplay.java @@ -181,8 +181,6 @@ public class HeadUpDisplay extends GLView { public void initialize(Context context, PreferenceGroup preferenceGroup) { mPreferenceGroup = preferenceGroup; mSharedPrefs = ComboPreferences.get(context); - mSharedPrefs.registerOnSharedPreferenceChangeListener( - mSharedPreferenceChangeListener); initializeIndicatorBar(context, preferenceGroup); } @@ -228,6 +226,8 @@ public class HeadUpDisplay extends GLView { private void hidePopupWindow() { mPopupWindow.popoff(); + // Unregister is important to avoid leaking activities. + // ComboPreference.sMap->ComboPreference->HeadUpDisplay->Activity mSharedPrefs.unregisterOnSharedPreferenceChangeListener( mSharedPreferenceChangeListener); if (mListener != null) { |