summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2017-09-03 11:57:21 -0400
committerMatthias Clasen <mclasen@redhat.com>2017-09-03 11:57:21 -0400
commit7bb202e4a2a243deae1755bd8802a4ce323dff19 (patch)
tree4755a4e6077197cd7b902a4e7f7e8b64ffec82e6
parent2101f26b4922b131895828ed668c0900e8182c3b (diff)
downloadgtk+-7bb202e4a2a243deae1755bd8802a4ce323dff19.tar.gz
Add a workaround for vulkan crashes
I see 'out of memory' errors and crashes inside libvulkan when creating nodes that have empty bounds and end up in the fallback paths, like a shadow around an empty text node. Prevent this by not creating text nodes in that case.
-rw-r--r--gtk/gskpango.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gtk/gskpango.c b/gtk/gskpango.c
index 5263e1c950..cb5fa76768 100644
--- a/gtk/gskpango.c
+++ b/gtk/gskpango.c
@@ -117,6 +117,13 @@ gsk_pango_renderer_show_text_glyphs (PangoRenderer *renderer,
int x_offset, y_offset;
GskRenderNode *node;
GdkRGBA color;
+ PangoRectangle ink_rect;
+
+ /* FIXME: vulkan fallbacks don't deal with empty nodes gracefully */
+ pango_glyph_string_extents (glyphs, font, &ink_rect, NULL);
+ pango_extents_to_pixels (&ink_rect, NULL);
+ if (ink_rect.width == 0 || ink_rect.height == 0)
+ return;
gtk_snapshot_get_offset (crenderer->snapshot, &x_offset, &y_offset);