• Sergey Ulanov's avatar
    Fix CommandBuffer vulkan handle leak in ExternalVkImageBacking · 3fcee08f
    Sergey Ulanov authored
    ExternalVkImageBacking was calling Initialize() for the command buffer
    returned from VulkanCommandPool::CreatePrimaryCommandBuffer(), but
    CreatePrimaryCommandBuffer() already calls Initialize(), i.e.
    Initialize() was called twice, which means VkCommandBuffer was created
    twice, while only second handle was freed in
    VulkanCommandBuffer::Destroy(), the other one was leaked.
    
    This change fixes the issue in ExternalVkImageBacking to avoid the
    second Initialize() call. Also added a DCHECK() to avoid this problem in
    the future.
    
    Bug: 1001296
    Change-Id: I043ddd53952a0650db5cd44835f8d4c244a6e722
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1792853
    Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
    Commit-Queue: Peng Huang <penghuang@chromium.org>
    Auto-Submit: Sergey Ulanov <sergeyu@chromium.org>
    Reviewed-by: default avatarPeng Huang <penghuang@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#694879}
    3fcee08f
vulkan_command_buffer.cc 11.6 KB