Fix unlinking nullptr error scopes if device init failed

When device initialization failed, DeviceBase::mCurrentErrorScope is
nullptr so we need to guard the call to UnlinkForShutdown.

Bug: chromium:1081998
Change-Id: I65a1948117fa9461f7fc8d2d1d70aef669bc375d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21685
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2020-05-29 08:04:48 +00:00 committed by Commit Bot service account
parent 0e5301c23e
commit 6ced832d74
1 changed files with 4 additions and 1 deletions

View File

@ -154,8 +154,11 @@ namespace dawn_native {
// At this point GPU operations are always finished, so we are in the disconnected state. // At this point GPU operations are always finished, so we are in the disconnected state.
mState = State::Disconnected; mState = State::Disconnected;
// mCurrentErrorScope can be null if we failed device initialization.
if (mCurrentErrorScope.Get() != nullptr) {
mCurrentErrorScope->UnlinkForShutdown();
}
mErrorScopeTracker = nullptr; mErrorScopeTracker = nullptr;
mCurrentErrorScope->UnlinkForShutdown();
mFenceSignalTracker = nullptr; mFenceSignalTracker = nullptr;
mDynamicUploader = nullptr; mDynamicUploader = nullptr;
mMapRequestTracker = nullptr; mMapRequestTracker = nullptr;