Commit ae11fe96 authored by Klaus Weidner's avatar Klaus Weidner Committed by Commit Bot

Avoid race condition for WebXR EndPresentation

In not-surfaceless mode, webxr_ may not be initialized yet at the time
we get an incoming SetWebVrMode(false) call which calls EndPresentation.
Add a check to avoid a crash in that scenario.

BUG=846102

Change-Id: Ib5cd0d2483de831c6690cb8e1d3dbf139da44778
Reviewed-on: https://chromium-review.googlesource.com/1102122Reviewed-by: default avatarBill Orr <billorr@chromium.org>
Commit-Queue: Klaus Weidner <klausw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567694}
parent a808d9f3
......@@ -2080,6 +2080,13 @@ void VrShellGl::SetWebVrMode(bool enabled) {
// as SubmitFrame from this session anymore. This makes it legal to cancel
// an outstanding animating frame (if any).
ClosePresentationBindings();
// In not-surfaceless mode, webxr_ may not be initialized yet at the time
// we get an incoming SetWebVrMode(false) call. In that case, skip the
// remaining steps.
if (!webxr_)
return;
// Ensure that re-entering VR later gets a fresh start by clearing out the
// current session's animating frame state.
webxr_->EndPresentation();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment