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

Commit 8ae349f

Browse files
authored
Fix panel restore on restart. (#3164)
1 parent 0c87393 commit 8ae349f

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -545,21 +545,18 @@ private void showPanel(@NonNull Windows.PanelType panelType, boolean switchSurfa
545545
setView(libraryView, switchSurface);
546546
libraryView.onShow();
547547
mViewModel.setIsPanelVisible(panelType, true);
548-
if (mRestoreFirstPaint == null && !isFirstPaintReady() && (mFirstDrawCallback != null)) {
548+
if (mRestoreFirstPaint == null && !isFirstPaintReady() && (mFirstDrawCallback != null) && (mSurface != null)) {
549+
final Runnable firstDrawCallback = mFirstDrawCallback;
549550
onFirstContentfulPaint(mSession.getGeckoSession());
550551
mRestoreFirstPaint = () -> {
551552
setFirstPaintReady(false);
552-
setFirstDrawCallback(() -> {
553-
setFirstPaintReady(true);
554-
if (mWidgetManager != null) {
555-
mWidgetManager.updateWidget(WindowWidget.this);
556-
}
557-
});
553+
setFirstDrawCallback(firstDrawCallback);
558554
if (mWidgetManager != null) {
559555
mWidgetManager.updateWidget(WindowWidget.this);
560556
}
561557
};
562558
}
559+
563560
}
564561
}
565562

@@ -575,7 +572,7 @@ public void hidePanel(@NonNull Windows.PanelType panelType, boolean switchSurfac
575572
mViewModel.setIsPanelVisible(panelType, false);
576573
}
577574
if (switchSurface && mRestoreFirstPaint != null) {
578-
mUIThreadExecutor.execute(mRestoreFirstPaint);
575+
mRestoreFirstPaint.run();
579576
mRestoreFirstPaint = null;
580577
}
581578
}

0 commit comments

Comments
 (0)