am 853f284c: am c9cb3083: Merge "Fix bug 3405899 - android.view.WindowManager" into honeycomb

* commit '853f284c0b80540cf447af0e6e704d7a05947efd':
  Fix bug 3405899 - android.view.WindowManager$BadTokenException
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index c4c4ae3..eee042a 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -7388,12 +7388,18 @@
 
         if (!mInsertionControllerEnabled) {
             hideInsertionPointCursorController();
-            mInsertionPointCursorController = null;
+            if (mInsertionPointCursorController != null) {
+                mInsertionPointCursorController.onDetached();
+                mInsertionPointCursorController = null;
+            }
         }
 
         if (!mSelectionControllerEnabled) {
             stopSelectionActionMode();
-            mSelectionModifierCursorController = null;
+            if (mSelectionModifierCursorController != null) {
+                mSelectionModifierCursorController.onDetached();
+                mSelectionModifierCursorController = null;
+            }
         }
     }