[gtk+] Plug a memory leak



commit b5ac277654ffe97df5e8a9383527a34238248059
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Sep 24 21:34:53 2017 -0400

    Plug a memory leak
    
    A function with ensure in the name would better check if the
    thing it is supposed to ensure already exists.

 gsk/gskvulkanimage.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gsk/gskvulkanimage.c b/gsk/gskvulkanimage.c
index 2540d8a..d09a109 100644
--- a/gsk/gskvulkanimage.c
+++ b/gsk/gskvulkanimage.c
@@ -299,7 +299,8 @@ static void
 gsk_vulkan_image_ensure_view (GskVulkanImage *self,
                               VkFormat        format)
 {
-  GSK_VK_CHECK (vkCreateImageView, gdk_vulkan_context_get_device (self->vulkan),
+  if (self->vk_image_view == VK_NULL_HANDLE)
+    GSK_VK_CHECK (vkCreateImageView, gdk_vulkan_context_get_device (self->vulkan),
                                    &(VkImageViewCreateInfo) {
                                        .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
                                        .image = self->vk_image,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]