summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGilles Debunne <debunne@google.com>2011-03-25 11:57:17 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-03-25 11:57:17 -0700
commit8da36372a390c76cbd3985b93eea881ad6a43040 (patch)
tree8caf8f19bd0dd5a507463eb27a408cb8f9e825e7 /core
parentba08462ebe766204089c68b346dd3dcf9ddd5fbb (diff)
parent6f72cf80576c17b888d4768dfcd14481087b7143 (diff)
downloadframeworks_base-8da36372a390c76cbd3985b93eea881ad6a43040.zip
frameworks_base-8da36372a390c76cbd3985b93eea881ad6a43040.tar.gz
frameworks_base-8da36372a390c76cbd3985b93eea881ad6a43040.tar.bz2
Merge "Fix a leak in TextView around ViewTreeObserver"
Diffstat (limited to 'core')
-rw-r--r--core/java/android/widget/TextView.java14
1 files changed, 6 insertions, 8 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 222bc84..ed9dce9 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -128,7 +128,6 @@ import android.widget.RemoteViews.RemoteView;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
-import java.util.HashSet;
/**
* Displays text to the user and optionally allows them to edit it. A TextView
@@ -3980,13 +3979,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
observer.removeOnPreDrawListener(this);
mPreDrawState = PREDRAW_NOT_REGISTERED;
}
- // No need to create the controller, as getXXController would.
- if (mInsertionPointCursorController != null) {
- observer.removeOnTouchModeChangeListener(mInsertionPointCursorController);
- }
- if (mSelectionModifierCursorController != null) {
- observer.removeOnTouchModeChangeListener(mSelectionModifierCursorController);
- }
if (mError != null) {
hideError();
@@ -9221,6 +9213,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
@Override
public void onDetached() {
+ final ViewTreeObserver observer = getViewTreeObserver();
+ observer.removeOnTouchModeChangeListener(this);
+
if (mHandle != null) mHandle.onDetached();
}
}
@@ -9349,6 +9344,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
@Override
public void onDetached() {
+ final ViewTreeObserver observer = getViewTreeObserver();
+ observer.removeOnTouchModeChangeListener(this);
+
if (mStartHandle != null) mStartHandle.onDetached();
if (mEndHandle != null) mEndHandle.onDetached();
}