Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit 63542e4

Browse files
MortimerGorokeianhzo
authored andcommitted
Fix crash when the app is closed while playing 360 videos (#1771)
1 parent e8838e2 commit 63542e4

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,6 @@ protected void onDestroy() {
395395
}
396396

397397
// Remove all widget listeners
398-
mTray.removeListeners(mWindows);
399-
mTray.onDestroy();
400398
mWindows.onDestroy();
401399

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

12101208
@Override
12111209
public void setTrayVisible(boolean visible) {
1212-
mTray.setTrayVisible(visible);
1210+
if (mTray != null && !mTray.isReleased()) {
1211+
mTray.setTrayVisible(visible);
1212+
}
12131213
}
12141214

12151215
@Override

app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/TrayWidget.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,6 @@ public void removeListeners(TrayListener... listeners) {
218218
mTrayListeners.removeAll(Arrays.asList(listeners));
219219
}
220220

221-
public void onDestroy() {
222-
mTrayListeners.clear();
223-
}
224-
225221
private void notifyBookmarksClicked() {
226222
mTrayListeners.forEach(TrayListener::onBookmarksClicked);
227223
}
@@ -266,6 +262,7 @@ public void releaseWidget() {
266262
}
267263

268264
mWidgetManager.removeUpdateListener(this);
265+
mTrayListeners.clear();
269266

270267
super.releaseWidget();
271268
}

app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/UIWidget.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public interface Delegate {
4949
protected int mBorderWidth;
5050
private Runnable mFirstDrawCallback;
5151
protected boolean mResizing = false;
52+
protected boolean mReleased = false;
5253

5354
public UIWidget(Context aContext) {
5455
super(aContext);
@@ -203,6 +204,11 @@ private void releaseRenderer() {
203204
public void releaseWidget() {
204205
releaseRenderer();
205206
mWidgetManager = null;
207+
mReleased = true;
208+
}
209+
210+
public boolean isReleased() {
211+
return mReleased;
206212
}
207213

208214
@Override

0 commit comments

Comments
 (0)