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 249509 afa9f14823bcb11c3410b6a58115037dea84ad54
parent 249508 92211305e25b174b2559a1d0c535714491204e01
child 249510 a3016e1e67d464a442733fdbf5cb82ae99248777
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle, sledru
bugs1089653
milestone37.0a2
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);
             }