Skip to content

Commit

Permalink
Fix crash when the app is closed while playing 360 videos (#1771)
Browse files Browse the repository at this point in the history
  • Loading branch information
MortimerGoro authored and keianhzo committed Sep 4, 2019
1 parent e8838e2 commit 63542e4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,6 @@ protected void onDestroy() {
}

// Remove all widget listeners
mTray.removeListeners(mWindows);
mTray.onDestroy();
mWindows.onDestroy();

SessionStore.get().onDestroy();
Expand Down Expand Up @@ -1209,7 +1207,9 @@ public void popWorldBrightness(Object aKey) {

@Override
public void setTrayVisible(boolean visible) {
mTray.setTrayVisible(visible);
if (mTray != null && !mTray.isReleased()) {
mTray.setTrayVisible(visible);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,6 @@ public void removeListeners(TrayListener... listeners) {
mTrayListeners.removeAll(Arrays.asList(listeners));
}

public void onDestroy() {
mTrayListeners.clear();
}

private void notifyBookmarksClicked() {
mTrayListeners.forEach(TrayListener::onBookmarksClicked);
}
Expand Down Expand Up @@ -266,6 +262,7 @@ public void releaseWidget() {
}

mWidgetManager.removeUpdateListener(this);
mTrayListeners.clear();

super.releaseWidget();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public interface Delegate {
protected int mBorderWidth;
private Runnable mFirstDrawCallback;
protected boolean mResizing = false;
protected boolean mReleased = false;

public UIWidget(Context aContext) {
super(aContext);
Expand Down Expand Up @@ -203,6 +204,11 @@ private void releaseRenderer() {
public void releaseWidget() {
releaseRenderer();
mWidgetManager = null;
mReleased = true;
}

public boolean isReleased() {
return mReleased;
}

@Override
Expand Down

0 comments on commit 63542e4

Please sign in to comment.