Bug 1089653 - Make sure the search activity hasn't been destroyed before touching views in onAnimationEnd. r=mfinkle, a=sledru
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Thu, 29 Jan 2015 13:37:51 +0100
changeset 243622 734264bcd6d1
parent 243621 e32f606d51e3
child 243623 ea6cff5fd829
push id4419
push userryanvm@gmail.com
push date2015-02-02 15:44 +0000
treeherdermozilla-beta@ea6cff5fd829 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle, sledru
bugs1089653
milestone36.0
Bug 1089653 - Make sure the search activity hasn't been destroyed before touching views in onAnimationEnd. r=mfinkle, a=sledru
mobile/android/search/java/org/mozilla/search/SearchActivity.java
--- a/mobile/android/search/java/org/mozilla/search/SearchActivity.java
+++ b/mobile/android/search/java/org/mozilla/search/SearchActivity.java
@@ -335,16 +335,21 @@ public class SearchActivity extends Loca
 
         set.addListener(new Animator.AnimatorListener() {
             @Override
             public void onAnimationStart(Animator animation) {
             }
 
             @Override
             public void onAnimationEnd(Animator animation) {
+                // Don't do anything if the activity is destroyed before the animation ends.
+                if (SearchActivity.this.isDestroyed()) {
+                    return;
+                }
+
                 setEditState(EditState.WAITING);
                 setSearchState(SearchState.POSTSEARCH);
 
                 // We need to manually clear the animation for the views to be hidden on gingerbread.
                 animationCard.clearAnimation();
                 animationCard.setVisibility(View.INVISIBLE);
             }