vk/cmd_buffer: Allow for null VkCmdPool's
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 4 Aug 2015 21:00:09 +0000 (14:00 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 4 Aug 2015 21:01:08 +0000 (14:01 -0700)
src/vulkan/anv_cmd_buffer.c

index 9ee5cf8b24757a18ff8996fd715805b772bdb57a..5178f6529abef6c1f751d050759978320349b527 100644 (file)
@@ -88,7 +88,14 @@ VkResult anv_CreateCommandBuffer(
 
    anv_cmd_state_init(&cmd_buffer->state);
 
-   list_addtail(&cmd_buffer->pool_link, &pool->cmd_buffers);
+   if (pool) {
+      list_addtail(&cmd_buffer->pool_link, &pool->cmd_buffers);
+   } else {
+      /* Init the pool_link so we can safefly call list_del when we destroy
+       * the command buffer
+       */
+      list_inithead(&cmd_buffer->pool_link);
+   }
 
    *pCmdBuffer = anv_cmd_buffer_to_handle(cmd_buffer);