[gtk+] gdkvulkan: Track if we reffed the display's vulkan data



commit efc5f8dc47ca03939ef0101ae36ca1411486dded
Author: Benjamin Otte <otte redhat com>
Date:   Wed Jan 4 18:26:14 2017 +0100

    gdkvulkan: Track if we reffed the display's vulkan data
    
    When reffing the display fails in init, we were still trying to unref
    it. Which obviously failed and spewed warnings to stderr.

 gdk/gdkvulkancontext.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gdk/gdkvulkancontext.c b/gdk/gdkvulkancontext.c
index a6b1732..dae6a34 100644
--- a/gdk/gdkvulkancontext.c
+++ b/gdk/gdkvulkancontext.c
@@ -45,6 +45,8 @@ struct _GdkVulkanContextPrivate {
 #endif
 
   guint32 draw_index;
+
+  guint vulkan_ref: 1;
 };
 
 enum {
@@ -166,7 +168,7 @@ gdk_vulkan_context_dispose (GObject *gobject)
 
   /* display will be unset in gdk_draw_context_dispose() */
   display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
-  if (display)
+  if (display && priv->vulkan_ref)
     gdk_display_unref_vulkan (display);
 
   G_OBJECT_CLASS (gdk_vulkan_context_parent_class)->dispose (gobject);
@@ -411,7 +413,8 @@ gdk_vulkan_context_real_init (GInitable     *initable,
   VkBool32 supported;
   uint32_t i;
 
-  if (!gdk_display_ref_vulkan (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)), error))
+  priv->vulkan_ref = gdk_display_ref_vulkan (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)), 
error);
+  if (!priv->vulkan_ref)
     return FALSE;
 
   res = GDK_VULKAN_CONTEXT_GET_CLASS (context)->create_surface (context, &priv->surface);


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