From 82027bd8acc223f73997cff7eace6e18ff84f251 Mon Sep 17 00:00:00 2001 From: Natasha Lee Date: Fri, 12 Jun 2020 08:13:41 +0000 Subject: [PATCH] Fix ResourceMemoryAllocation null dereference Moves last TickImpl call during ShutDown to only be called if the device was fully created. Bug: dawn:400, chromium:1093639 Change-Id: I25437e3b33d0fc57f21e82c63bfb0fd4d9384175 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23123 Reviewed-by: Austin Eng Reviewed-by: Rafael Cintron Reviewed-by: Corentin Wallez Commit-Queue: Corentin Wallez --- src/dawn_native/Device.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dawn_native/Device.cpp b/src/dawn_native/Device.cpp index 73bbcf9af0..211c321793 100644 --- a/src/dawn_native/Device.cpp +++ b/src/dawn_native/Device.cpp @@ -152,6 +152,9 @@ namespace dawn_native { mErrorScopeTracker->Tick(GetCompletedCommandSerial()); mFenceSignalTracker->Tick(GetCompletedCommandSerial()); mMapRequestTracker->Tick(GetCompletedCommandSerial()); + // call TickImpl once last time to clean up resources + // assert the errors are device loss so we can continue with destruction + AssertAndIgnoreDeviceLossError(TickImpl()); } // At this point GPU operations are always finished, so we are in the disconnected state. @@ -166,9 +169,6 @@ namespace dawn_native { mDynamicUploader = nullptr; mMapRequestTracker = nullptr; - // call TickImpl once last time to clean up resources - // assert the errors are device loss so we can continue with destruction - AssertAndIgnoreDeviceLossError(TickImpl()); AssumeCommandsComplete(); // Tell the backend that it can free all the objects now that the GPU timeline is empty. ShutDownImpl();