gl: Don't use memcmp for comparing cache keys
authorMatthias Clasen <mclasen@redhat.com>
Sat, 12 Oct 2019 05:00:08 +0000 (01:00 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 12 Oct 2019 05:00:08 +0000 (01:00 -0400)
Some innocent change made us use a stack-allocated
key, and things broke. Lets go back to comparing
cache keys field by field.

gsk/gl/gskglglyphcache.c

index 66b84a02beded569e0ba53c45593faae2c8caf8f..f7cb6fc2c6df69a48f63e1a388acde5619789ad7 100644 (file)
@@ -79,7 +79,14 @@ gsk_gl_glyph_cache_unref (GskGLGlyphCache *self)
 static gboolean
 glyph_cache_equal (gconstpointer v1, gconstpointer v2)
 {
-  return memcmp (v1, v2, sizeof (GlyphCacheKey)) == 0;
+  const GlyphCacheKey *key1 = v1;
+  const GlyphCacheKey *key2 = v2;
+
+  return key1->font == key2->font &&
+         key1->glyph == key2->glyph &&
+         key1->xshift == key2->xshift &&
+         key1->yshift == key2->yshift &&
+         key1->scale == key2->scale;
 }
 
 static guint