Browse Source

Fixed potential memory leak, moved variables

master
Anthony Restaino 9 years ago
parent
commit
8132b34bbf
  1. 8
      app/src/main/java/acr/browser/lightning/activity/TabsManager.java
  2. 1
      app/src/main/java/acr/browser/lightning/browser/BrowserPresenter.java

8
app/src/main/java/acr/browser/lightning/activity/TabsManager.java

@ -47,6 +47,9 @@ public class TabsManager { @@ -47,6 +47,9 @@ public class TabsManager {
@Nullable private LightningView mCurrentTab;
@Nullable private TabNumberChangedListener mTabNumberListener;
private boolean mIsInitialized = false;
private List<Runnable> mPostInitializationWorkList = new ArrayList<>();
@Inject PreferenceManager mPreferenceManager;
@Inject Bus mEventBus;
@Inject Application mApp;
@ -64,8 +67,9 @@ public class TabsManager { @@ -64,8 +67,9 @@ public class TabsManager {
mTabNumberListener = listener;
}
private boolean mIsInitialized = false;
private List<Runnable> mPostInitializationWorkList = new ArrayList<>();
public void cancelPendingWork() {
mPostInitializationWorkList.clear();
}
public void doAfterInitialization(@NonNull Runnable runnable) {
if (mIsInitialized) {

1
app/src/main/java/acr/browser/lightning/browser/BrowserPresenter.java

@ -216,6 +216,7 @@ public class BrowserPresenter { @@ -216,6 +216,7 @@ public class BrowserPresenter {
public void shutdown() {
onTabChanged(null);
mTabsModel.setTabNumberChangedListener(null);
mTabsModel.cancelPendingWork();
}
public void tabChanged(int position) {

Loading…
Cancel
Save