Skip to content

Commit

Permalink
Fix panel restore on restart.
Browse files Browse the repository at this point in the history
  • Loading branch information
bluemarvin committed Apr 15, 2020
1 parent fa882ff commit 306cf8a
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -545,21 +545,18 @@ private void showPanel(@NonNull Windows.PanelType panelType, boolean switchSurfa
setView(libraryView, switchSurface);
libraryView.onShow();
mViewModel.setIsPanelVisible(panelType, true);
if (mRestoreFirstPaint == null && !isFirstPaintReady() && (mFirstDrawCallback != null)) {
if (mRestoreFirstPaint == null && !isFirstPaintReady() && (mFirstDrawCallback != null) && (mSurface != null)) {
final Runnable firstDrawCallback = mFirstDrawCallback;
onFirstContentfulPaint(mSession.getGeckoSession());
mRestoreFirstPaint = () -> {
setFirstPaintReady(false);
setFirstDrawCallback(() -> {
setFirstPaintReady(true);
if (mWidgetManager != null) {
mWidgetManager.updateWidget(WindowWidget.this);
}
});
setFirstDrawCallback(firstDrawCallback);
if (mWidgetManager != null) {
mWidgetManager.updateWidget(WindowWidget.this);
}
};
}

}
}

Expand All @@ -575,7 +572,7 @@ public void hidePanel(@NonNull Windows.PanelType panelType, boolean switchSurfac
mViewModel.setIsPanelVisible(panelType, false);
}
if (switchSurface && mRestoreFirstPaint != null) {
mUIThreadExecutor.execute(mRestoreFirstPaint);
mRestoreFirstPaint.run();
mRestoreFirstPaint = null;
}
}
Expand Down

0 comments on commit 306cf8a

Please sign in to comment.