summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2017-01-04 18:26:14 +0100
committerBenjamin Otte <otte@redhat.com>2017-01-04 18:26:14 +0100
commitefc5f8dc47ca03939ef0101ae36ca1411486dded (patch)
treead4bd63552562c93d55bec61d31a60808ca8e0ae
parent3887548d554e3151a5997f81f8657e97b5a2a34d (diff)
downloadgtk+-efc5f8dc47ca03939ef0101ae36ca1411486dded.tar.gz
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.
-rw-r--r--gdk/gdkvulkancontext.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gdk/gdkvulkancontext.c b/gdk/gdkvulkancontext.c
index a6b1732619..dae6a345a9 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);