Bug 1562622 - Calling getViewTreeObserver again to get new object to test isAlive(). r=VladBaicu, a=RyanVM
authorBrad Arant <brad.arant@softvision.com>
Wed, 31 Jul 2019 14:35:08 +0000
changeset 541702 d8752d92d911198c48670581d82b65d770e5e789
parent 541701 a731e8f57ad520c711182324a5f0174bcbf71818
child 541703 43c35ee16e3ebeeb54b99f2d2467b30e22ba69ef
push id11685
push userryanvm@gmail.com
push dateFri, 02 Aug 2019 01:59:38 +0000
treeherdermozilla-beta@43c35ee16e3e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersVladBaicu, RyanVM
bugs1562622
milestone69.0
Bug 1562622 - Calling getViewTreeObserver again to get new object to test isAlive(). r=VladBaicu, a=RyanVM Differential Revision: https://phabricator.services.mozilla.com/D39929
mobile/android/base/java/org/mozilla/gecko/home/TabMenuStripLayout.java
--- a/mobile/android/base/java/org/mozilla/gecko/home/TabMenuStripLayout.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/TabMenuStripLayout.java
@@ -124,16 +124,17 @@ class TabMenuStripLayout extends ThemedL
 
     void onPageSelected(final int position) {
         // Callback to measure and draw the strip after the view is visible.
         ViewTreeObserver vto = getViewTreeObserver();
         if (vto.isAlive()) {
             vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
                 @Override
                 public void onGlobalLayout() {
+                    ViewTreeObserver vto = getViewTreeObserver();
                     if (!vto.isAlive()) {
                         return;
                     }
                     // let's ensure that we are calling this only once
                     vto.removeOnGlobalLayoutListener(this);
                     if (selectedView != null) {
                         selectedView.setTextColor(inactiveTextColor);
                     }