A bunch of fixes for calling abandon on vulkan context.

With this change, we still can't run the abanondContext test since we
currently don't have a way to abandon the AMD VulkanMemoryAllocator.

Bug: skia:8277
Change-Id: Ibc64e3d6908f81835a9814d29b37f24b56ebc1b1
Reviewed-on: https://skia-review.googlesource.com/149040
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index b0c5aee..21eca8a 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -252,7 +252,9 @@
         if (DisconnectType::kCleanup == type) {
             this->destroyResources();
         } else {
-            fCurrentCmdBuffer->unrefAndAbandon();
+            if (fCurrentCmdBuffer) {
+                fCurrentCmdBuffer->unrefAndAbandon();
+            }
             for (int i = 0; i < fSemaphoresToWaitOn.count(); ++i) {
                 fSemaphoresToWaitOn[i]->unrefAndAbandon();
             }
@@ -263,6 +265,8 @@
 
             // must call this just before we destroy the command pool and VkDevice
             fResourceProvider.abandonResources();
+
+            fMemoryAllocator.reset();
         }
         fSemaphoresToWaitOn.reset();
         fSemaphoresToSignal.reset();