mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 728263 - Avoid AccountManager leak error on exit. r=mfinkle
This commit is contained in:
parent
25be994f64
commit
9c4c1d64a0
@ -112,6 +112,7 @@ public class AboutHomeContent extends ScrollView {
|
||||
private LayoutInflater mInflater;
|
||||
|
||||
private AccountManager mAccountManager;
|
||||
private OnAccountsUpdateListener mAccountListener = null;
|
||||
|
||||
protected SimpleCursorAdapter mTopSitesAdapter;
|
||||
protected GridView mTopSitesGrid;
|
||||
@ -139,7 +140,7 @@ public class AboutHomeContent extends ScrollView {
|
||||
mAccountManager = AccountManager.get(context);
|
||||
|
||||
// The listener will run on the background thread (see 2nd argument)
|
||||
mAccountManager.addOnAccountsUpdatedListener(new OnAccountsUpdateListener() {
|
||||
mAccountManager.addOnAccountsUpdatedListener(mAccountListener = new OnAccountsUpdateListener() {
|
||||
public void onAccountsUpdated(Account[] accounts) {
|
||||
final GeckoApp.StartupMode startupMode = GeckoApp.mAppContext.getStartupMode();
|
||||
final boolean syncIsSetup = isSyncSetup();
|
||||
@ -210,6 +211,13 @@ public class AboutHomeContent extends ScrollView {
|
||||
});
|
||||
}
|
||||
|
||||
public void onDestroy() {
|
||||
if (mAccountListener != null) {
|
||||
mAccountManager.removeOnAccountsUpdatedListener(mAccountListener);
|
||||
mAccountListener = null;
|
||||
}
|
||||
}
|
||||
|
||||
void setLastTabsVisibility(boolean visible) {
|
||||
int visibility = visible ? View.VISIBLE : View.GONE;
|
||||
findViewById(R.id.last_tabs_title).setVisibility(visibility);
|
||||
|
@ -2190,6 +2190,10 @@ abstract public class GeckoApp
|
||||
super.onDestroy();
|
||||
|
||||
unregisterReceiver(mBatteryReceiver);
|
||||
|
||||
if (mAboutHomeContent != null) {
|
||||
mAboutHomeContent.onDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user