Don't fill last render task map with nullptrs

Bug: skia:10320
Change-Id: I8d388c273f37f3dd104a2940032966b477d9a92a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295199
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 4ca5496..8180924 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -378,6 +378,7 @@
         SkASSERT(!fDAG.renderTask(i) || fDAG.renderTask(i)->unique());
     }
 #endif
+    fLastRenderTasks.reset();
     fDAG.reset();
     this->clearDDLTargets();
 
@@ -617,7 +618,12 @@
         SkASSERT(prior->isClosed());
     }
 #endif
-    fLastRenderTasks.set(proxy->uniqueID().asUInt(), task);
+    uint32_t key = proxy->uniqueID().asUInt();
+    if (task) {
+        fLastRenderTasks.set(key, task);
+    } else if (fLastRenderTasks.find(key)) {
+        fLastRenderTasks.remove(key);
+    }
 }
 
 GrRenderTask* GrDrawingManager::getLastRenderTask(const GrSurfaceProxy* proxy) const {