vulkan: Don't leak references

gdk_vulkan_init_dmabuf takes a Vulkan reference. It is dropped
in gdk_display_dispose, but only if we get as far as setting
vk_dmabuf_formats. Therefore, we must drop the reference if
we take an early exit before that happens.

Related: #7150
This commit is contained in:
Matthias Clasen
2024-11-11 07:47:45 -05:00
parent b33cf6d82b
commit b4e90bdcf6

View File

@@ -1940,10 +1940,15 @@ gdk_vulkan_init_dmabuf (GdkDisplay *display)
if (display->vk_dmabuf_formats != NULL)
return;
if (!gdk_has_feature (GDK_FEATURE_DMABUF) ||
!gdk_display_init_vulkan (display, NULL) ||
((display->vulkan_features & GDK_VULKAN_FEATURE_DMABUF) == 0))
if (!gdk_has_feature (GDK_FEATURE_DMABUF))
return;
if (!gdk_display_init_vulkan (display, NULL))
return;
if ((display->vulkan_features & GDK_VULKAN_FEATURE_DMABUF) == 0)
{
gdk_display_unref_vulkan (display);
return;
}