vk: Fixup for missing resource reference

- Missing ref increment when using framebuffer could lead to use-after-free.
  How master was not crashing is surprising
This commit is contained in:
kd-11 2019-06-14 15:52:31 +03:00 committed by kd-11
parent c90186cf35
commit e515d9b83a

View file

@ -361,11 +361,11 @@ namespace vk
void run(vk::command_buffer &cmd, u16 w, u16 h, vk::image* target, const std::vector<vk::image_view*>& src, VkRenderPass render_pass) void run(vk::command_buffer &cmd, u16 w, u16 h, vk::image* target, const std::vector<vk::image_view*>& src, VkRenderPass render_pass)
{ {
vk::framebuffer *fbo = get_framebuffer(target, render_pass); auto fbo = static_cast<vk::framebuffer_holder*>(get_framebuffer(target, render_pass));
fbo->add_ref();
run(cmd, w, h, fbo, src, render_pass); run(cmd, w, h, fbo, src, render_pass);
fbo->release();
static_cast<vk::framebuffer_holder*>(fbo)->release();
} }
void run(vk::command_buffer &cmd, u16 w, u16 h, vk::image* target, vk::image_view* src, VkRenderPass render_pass) void run(vk::command_buffer &cmd, u16 w, u16 h, vk::image* target, vk::image_view* src, VkRenderPass render_pass)