From 6ced832d74d9cd86471b0232e69306d21fb56205 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Fri, 29 May 2020 08:04:48 +0000 Subject: [PATCH] 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 Reviewed-by: Stephen White Commit-Queue: Corentin Wallez --- src/dawn_native/Device.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dawn_native/Device.cpp b/src/dawn_native/Device.cpp index db4936a9d7..b3f4766ac7 100644 --- a/src/dawn_native/Device.cpp +++ b/src/dawn_native/Device.cpp @@ -154,8 +154,11 @@ namespace dawn_native { // At this point GPU operations are always finished, so we are in the disconnected state. mState = State::Disconnected; + // mCurrentErrorScope can be null if we failed device initialization. + if (mCurrentErrorScope.Get() != nullptr) { + mCurrentErrorScope->UnlinkForShutdown(); + } mErrorScopeTracker = nullptr; - mCurrentErrorScope->UnlinkForShutdown(); mFenceSignalTracker = nullptr; mDynamicUploader = nullptr; mMapRequestTracker = nullptr;