From 565246b3504d1a6b15f4cbcb156c901e0195fe3a Mon Sep 17 00:00:00 2001 From: Nick Alexander Date: Thu, 12 Feb 2015 15:14:37 -0800 Subject: [PATCH] Bug 1131635 - Make sure view was not destroyed before updating UI. r=nalexander We already used this work-around in RemoteTabsPanel. --HG-- extra : rebase_source : b5c5fe309681623f7cb279674683a2c723cb5da6 --- .../base/home/RemoteTabsExpandableListFragment.java | 7 +++++++ mobile/android/base/home/RemoteTabsSplitPlaneFragment.java | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/mobile/android/base/home/RemoteTabsExpandableListFragment.java b/mobile/android/base/home/RemoteTabsExpandableListFragment.java index 8f5e7e487807..3ccfd06f101f 100644 --- a/mobile/android/base/home/RemoteTabsExpandableListFragment.java +++ b/mobile/android/base/home/RemoteTabsExpandableListFragment.java @@ -175,6 +175,13 @@ public class RemoteTabsExpandableListFragment extends RemoteTabsBaseFragment { @Override protected void updateUiFromClients(List clients, List hiddenClients) { + if (getView() == null) { + // Early abort. It is possible to get UI updates after the view is + // destroyed; this can happen due to asynchronous loaders or + // animations complete. + return; + } + // We have three states: no clients (including hidden clients) at all; // all clients hidden; some clients hidden. We want to show the empty // list view only when we have no clients at all. This flag diff --git a/mobile/android/base/home/RemoteTabsSplitPlaneFragment.java b/mobile/android/base/home/RemoteTabsSplitPlaneFragment.java index 73c4f32f86fa..63073fb848ce 100644 --- a/mobile/android/base/home/RemoteTabsSplitPlaneFragment.java +++ b/mobile/android/base/home/RemoteTabsSplitPlaneFragment.java @@ -204,6 +204,13 @@ public class RemoteTabsSplitPlaneFragment extends RemoteTabsBaseFragment { @Override protected void updateUiFromClients(List clients, List hiddenClients) { + if (getView() == null) { + // Early abort. It is possible to get UI updates after the view is + // destroyed; this can happen due to asynchronous loaders or + // animations complete. + return; + } + // We have three states: no clients (including hidden clients) at all; // all clients hidden; some clients hidden. We want to show the empty // list view only when we have no clients at all. This flag