aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDima Kogan2015-11-09 18:36:05 +0200
committerEli Zaretskii2015-11-09 18:36:05 +0200
commitc6c16fb3f8fe5909baafd53c6b26153dec021064 (patch)
tree9506779b8114d68e13e320817c3c518264e6a463 /src
parent1087305574fd61256d66eb0c995f8bb74bd91afe (diff)
downloademacs-c6c16fb3f8fe5909baafd53c6b26153dec021064.tar.gz
emacs-c6c16fb3f8fe5909baafd53c6b26153dec021064.zip
Fix a memory leak in GC of font cache
* src/alloc.c (compact_font_cache_entry): Don't GC unmarked font entities if some of the fonts it references are marked. This plugs a memory leak. (Bug#21556)
Diffstat (limited to 'src')
-rw-r--r--src/alloc.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 60751bcfe2b..81d644a16ad 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -5328,11 +5328,35 @@ compact_font_cache_entry (Lisp_Object entry)
5328 are not marked too. But we must be sure that nothing is 5328 are not marked too. But we must be sure that nothing is
5329 marked within OBJ before we really drop it. */ 5329 marked within OBJ before we really drop it. */
5330 for (i = 0; i < size; i++) 5330 for (i = 0; i < size; i++)
5331 if (VECTOR_MARKED_P (XFONT_ENTITY (AREF (XCDR (obj), i)))) 5331 {
5332 break; 5332 Lisp_Object objlist;
5333
5334 if (VECTOR_MARKED_P (XFONT_ENTITY (AREF (XCDR (obj), i))))
5335 break;
5336
5337 objlist = AREF (AREF (XCDR (obj), i), FONT_OBJLIST_INDEX);
5338 for (; CONSP (objlist); objlist = XCDR (objlist))
5339 {
5340 Lisp_Object val = XCAR (objlist);
5341 struct font *font = XFONT_OBJECT (val);
5342
5343 if (!NILP (AREF (val, FONT_TYPE_INDEX))
5344 && VECTOR_MARKED_P(font))
5345 break;
5346 }
5347 if (CONSP (objlist))
5348 {
5349 /* Foiund a marked font, bail out. */
5350 break;
5351 }
5352 }
5333 5353
5334 if (i == size) 5354 if (i == size)
5335 drop = 1; 5355 {
5356 /* No marked fonts were found, so this entire font
5357 entity can be dropped. */
5358 drop = 1;
5359 }
5336 } 5360 }
5337 if (drop) 5361 if (drop)
5338 *prev = XCDR (tail); 5362 *prev = XCDR (tail);