aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Antipov2013-12-13 19:55:23 +0400
committerDmitry Antipov2013-12-13 19:55:23 +0400
commit5035fbc19e2f569674237c61e6ffdd4719e092d5 (patch)
tree86e7b51ececff332f6bd3bebd92f389cc4024ce8
parentb6c888cc7afed65f24c023b8e90b73649f438e14 (diff)
downloademacs-5035fbc19e2f569674237c61e6ffdd4719e092d5.tar.gz
emacs-5035fbc19e2f569674237c61e6ffdd4719e092d5.zip
* alloc.c, font.c, font.h, ftfont.c, ftxfont.c, macfont.m,
* nsfont.m, w32font.c, xfont.c, xftfont.c: Revert last and 2013-12-12 font-related change to avoid Bug#16128, which is quite hard to fix without even more substantial changes.
-rw-r--r--src/ChangeLog7
-rw-r--r--src/alloc.c20
-rw-r--r--src/font.c24
-rw-r--r--src/font.h7
-rw-r--r--src/ftfont.c1
-rw-r--r--src/ftxfont.c1
-rw-r--r--src/macfont.m2
-rw-r--r--src/nsfont.m1
-rw-r--r--src/w32font.c1
-rw-r--r--src/xfont.c1
-rw-r--r--src/xftfont.c1
11 files changed, 19 insertions, 47 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 2ae2f99b49a..4e8285e9530 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,12 @@
12013-12-13 Dmitry Antipov <dmantipov@yandex.ru> 12013-12-13 Dmitry Antipov <dmantipov@yandex.ru>
2 2
3 * alloc.c, font.c, font.h, ftfont.c, ftxfont.c, macfont.m,
4 * nsfont.m, w32font.c, xfont.c, xftfont.c: Revert last and
5 2013-12-12 font-related change to avoid Bug#16128, which
6 is quite hard to fix without even more substantial changes.
7
82013-12-13 Dmitry Antipov <dmantipov@yandex.ru>
9
3 * font.c (font_close_object): Check for live frame (Bug#16128). 10 * font.c (font_close_object): Check for live frame (Bug#16128).
4 11
52013-12-13 Paul Eggert <eggert@cs.ucla.edu> 122013-12-13 Paul Eggert <eggert@cs.ucla.edu>
diff --git a/src/alloc.c b/src/alloc.c
index 022d1e5dcbb..aeda42637cd 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -2874,22 +2874,10 @@ vector_nbytes (struct Lisp_Vector *v)
2874static void 2874static void
2875cleanup_vector (struct Lisp_Vector *vector) 2875cleanup_vector (struct Lisp_Vector *vector)
2876{ 2876{
2877 if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_FONT)) 2877 if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_FONT)
2878 { 2878 && ((vector->header.size & PSEUDOVECTOR_SIZE_MASK)
2879 ptrdiff_t size = vector->header.size & PSEUDOVECTOR_SIZE_MASK; 2879 == FONT_OBJECT_MAX))
2880 Lisp_Object obj = make_lisp_ptr (vector, Lisp_Vectorlike); 2880 ((struct font *) vector)->driver->close ((struct font *) vector);
2881
2882 if (size == FONT_OBJECT_MAX)
2883 font_close_object (obj);
2884#ifdef HAVE_NS
2885 else if (size == FONT_ENTITY_MAX)
2886 {
2887 struct font_entity *entity = (struct font_entity *) vector;
2888 if (entity->driver && entity->driver->free_entity)
2889 entity->driver->free_entity (obj);
2890 }
2891#endif /* HAVE_NS */
2892 }
2893} 2881}
2894 2882
2895/* Reclaim space used by unmarked vectors. */ 2883/* Reclaim space used by unmarked vectors. */
diff --git a/src/font.c b/src/font.c
index 9f284440143..fb56b3d3fb3 100644
--- a/src/font.c
+++ b/src/font.c
@@ -173,9 +173,6 @@ font_make_entity (void)
173 allocate_pseudovector (VECSIZE (struct font_entity), 173 allocate_pseudovector (VECSIZE (struct font_entity),
174 FONT_ENTITY_MAX, PVEC_FONT)); 174 FONT_ENTITY_MAX, PVEC_FONT));
175 XSETFONT (font_entity, entity); 175 XSETFONT (font_entity, entity);
176#ifdef HAVE_NS
177 entity->driver = NULL;
178#endif
179 return font_entity; 176 return font_entity;
180} 177}
181 178
@@ -2884,10 +2881,10 @@ font_open_entity (struct frame *f, Lisp_Object entity, int pixel_size)
2884} 2881}
2885 2882
2886 2883
2887/* Close FONT_OBJECT. */ 2884/* Close FONT_OBJECT that is opened on frame F. */
2888 2885
2889void 2886static void
2890font_close_object (Lisp_Object font_object) 2887font_close_object (struct frame *f, Lisp_Object font_object)
2891{ 2888{
2892 struct font *font = XFONT_OBJECT (font_object); 2889 struct font *font = XFONT_OBJECT (font_object);
2893 2890
@@ -2897,13 +2894,8 @@ font_close_object (Lisp_Object font_object)
2897 FONT_ADD_LOG ("close", font_object, Qnil); 2894 FONT_ADD_LOG ("close", font_object, Qnil);
2898 font->driver->close (font); 2895 font->driver->close (font);
2899#ifdef HAVE_WINDOW_SYSTEM 2896#ifdef HAVE_WINDOW_SYSTEM
2900 eassert (font->frame); 2897 eassert (FRAME_DISPLAY_INFO (f)->n_fonts);
2901 /* If the frame is gone, we can't do anything (Bug#16128). */ 2898 FRAME_DISPLAY_INFO (f)->n_fonts--;
2902 if (FRAME_LIVE_P (font->frame))
2903 {
2904 eassert (FRAME_DISPLAY_INFO (font->frame)->n_fonts);
2905 FRAME_DISPLAY_INFO (font->frame)->n_fonts--;
2906 }
2907#endif 2899#endif
2908} 2900}
2909 2901
@@ -4556,11 +4548,11 @@ DEFUN ("open-font", Fopen_font, Sopen_font, 1, 3, 0,
4556} 4548}
4557 4549
4558DEFUN ("close-font", Fclose_font, Sclose_font, 1, 2, 0, 4550DEFUN ("close-font", Fclose_font, Sclose_font, 1, 2, 0,
4559 doc: /* Close FONT-OBJECT. Optional FRAME is unused. */) 4551 doc: /* Close FONT-OBJECT. */)
4560 (Lisp_Object font_object, Lisp_Object frame) 4552 (Lisp_Object font_object, Lisp_Object frame)
4561{ 4553{
4562 CHECK_FONT_OBJECT (font_object); 4554 CHECK_FONT_OBJECT (font_object);
4563 font_close_object (font_object); 4555 font_close_object (decode_live_frame (frame), font_object);
4564 return Qnil; 4556 return Qnil;
4565} 4557}
4566 4558
@@ -4895,7 +4887,7 @@ If the named font is not yet loaded, return nil. */)
4895 /* As font_object is still in FONT_OBJLIST of the entity, we can't 4887 /* As font_object is still in FONT_OBJLIST of the entity, we can't
4896 close it now. Perhaps, we should manage font-objects 4888 close it now. Perhaps, we should manage font-objects
4897 by `reference-count'. */ 4889 by `reference-count'. */
4898 font_close_object (font_object); 4890 font_close_object (f, font_object);
4899#endif 4891#endif
4900 return info; 4892 return info;
4901} 4893}
diff --git a/src/font.h b/src/font.h
index 7781816860a..539ebeba52a 100644
--- a/src/font.h
+++ b/src/font.h
@@ -265,9 +265,6 @@ struct font_entity
265{ 265{
266 struct vectorlike_header header; 266 struct vectorlike_header header;
267 Lisp_Object props[FONT_ENTITY_MAX]; 267 Lisp_Object props[FONT_ENTITY_MAX];
268#ifdef HAVE_NS
269 struct font_driver *driver;
270#endif
271}; 268};
272 269
273/* A value which may appear in the member `encoding' of struct font 270/* A value which may appear in the member `encoding' of struct font
@@ -319,9 +316,6 @@ struct font
319 316
320#if defined (HAVE_WINDOW_SYSTEM) 317#if defined (HAVE_WINDOW_SYSTEM)
321 318
322 /* The frame where the font was opened. */
323 struct frame *frame;
324
325 /* Vertical pixel width of the underline. If is zero if that 319 /* Vertical pixel width of the underline. If is zero if that
326 information is not in the font. */ 320 information is not in the font. */
327 int underline_thickness; 321 int underline_thickness;
@@ -741,7 +735,6 @@ extern Lisp_Object merge_font_spec (Lisp_Object, Lisp_Object);
741 735
742extern Lisp_Object font_make_entity (void); 736extern Lisp_Object font_make_entity (void);
743extern Lisp_Object font_make_object (int, Lisp_Object, int); 737extern Lisp_Object font_make_object (int, Lisp_Object, int);
744extern void font_close_object (Lisp_Object);
745 738
746extern Lisp_Object find_font_encoding (Lisp_Object); 739extern Lisp_Object find_font_encoding (Lisp_Object);
747extern int font_registry_charsets (Lisp_Object, struct charset **, 740extern int font_registry_charsets (Lisp_Object, struct charset **,
diff --git a/src/ftfont.c b/src/ftfont.c
index 36780454257..6a2303ab4a7 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -1236,7 +1236,6 @@ ftfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
1236 ASET (font_object, FONT_FILE_INDEX, filename); 1236 ASET (font_object, FONT_FILE_INDEX, filename);
1237 ASET (font_object, FONT_FORMAT_INDEX, ftfont_font_format (NULL, filename)); 1237 ASET (font_object, FONT_FORMAT_INDEX, ftfont_font_format (NULL, filename));
1238 font = XFONT_OBJECT (font_object); 1238 font = XFONT_OBJECT (font_object);
1239 font->frame = f;
1240 ftfont_info = (struct ftfont_info *) font; 1239 ftfont_info = (struct ftfont_info *) font;
1241 ftfont_info->ft_size = ft_face->size; 1240 ftfont_info->ft_size = ft_face->size;
1242 ftfont_info->index = XINT (idx); 1241 ftfont_info->index = XINT (idx);
diff --git a/src/ftxfont.c b/src/ftxfont.c
index b44905d88cd..d1aa3e40403 100644
--- a/src/ftxfont.c
+++ b/src/ftxfont.c
@@ -255,7 +255,6 @@ ftxfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
255 if (NILP (font_object)) 255 if (NILP (font_object))
256 return Qnil; 256 return Qnil;
257 font = XFONT_OBJECT (font_object); 257 font = XFONT_OBJECT (font_object);
258 eassert (font->frame == f);
259 font->driver = &ftxfont_driver; 258 font->driver = &ftxfont_driver;
260 return font_object; 259 return font_object;
261} 260}
diff --git a/src/macfont.m b/src/macfont.m
index 66833cd1b80..10623eb12fe 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -882,7 +882,6 @@ macfont_descriptor_entity (FontDescriptorRef desc, Lisp_Object extra,
882 CFStringRef name; 882 CFStringRef name;
883 883
884 entity = font_make_entity (); 884 entity = font_make_entity ();
885 XFONT_ENTITY (entity)->driver = &macfont_driver;
886 885
887 ASET (entity, FONT_TYPE_INDEX, macfont_driver.type); 886 ASET (entity, FONT_TYPE_INDEX, macfont_driver.type);
888 ASET (entity, FONT_REGISTRY_INDEX, Qiso10646_1); 887 ASET (entity, FONT_REGISTRY_INDEX, Qiso10646_1);
@@ -2492,7 +2491,6 @@ macfont_open (struct frame * f, Lisp_Object entity, int pixel_size)
2492 ASET (font_object, FONT_FULLNAME_INDEX, 2491 ASET (font_object, FONT_FULLNAME_INDEX,
2493 AREF (font_object, FONT_NAME_INDEX)); 2492 AREF (font_object, FONT_NAME_INDEX));
2494 font = XFONT_OBJECT (font_object); 2493 font = XFONT_OBJECT (font_object);
2495 font->frame = f;
2496 font->pixel_size = size; 2494 font->pixel_size = size;
2497 font->driver = &macfont_driver; 2495 font->driver = &macfont_driver;
2498 font->encoding_charset = font->repertory_charset = -1; 2496 font->encoding_charset = font->repertory_charset = -1;
diff --git a/src/nsfont.m b/src/nsfont.m
index a794c9eed41..0f546408316 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -805,7 +805,6 @@ nsfont_open (struct frame *f, Lisp_Object font_entity, int pixel_size)
805 return Qnil; /* FIXME: other terms do, but return Qnil causes segfault */ 805 return Qnil; /* FIXME: other terms do, but return Qnil causes segfault */
806 } 806 }
807 807
808 font->frame = f;
809 font_info->glyphs = xzalloc (0x100 * sizeof *font_info->glyphs); 808 font_info->glyphs = xzalloc (0x100 * sizeof *font_info->glyphs);
810 font_info->metrics = xzalloc (0x100 * sizeof *font_info->metrics); 809 font_info->metrics = xzalloc (0x100 * sizeof *font_info->metrics);
811 810
diff --git a/src/w32font.c b/src/w32font.c
index 20469274969..654e0d9cae4 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -999,7 +999,6 @@ w32font_open_internal (struct frame *f, Lisp_Object font_entity,
999 = DECODE_SYSTEM (build_string (logfont.lfFaceName)); 999 = DECODE_SYSTEM (build_string (logfont.lfFaceName));
1000 } 1000 }
1001 1001
1002 font->frame = f;
1003 font->max_width = w32_font->metrics.tmMaxCharWidth; 1002 font->max_width = w32_font->metrics.tmMaxCharWidth;
1004 /* Parts of Emacs display assume that height = ascent + descent... 1003 /* Parts of Emacs display assume that height = ascent + descent...
1005 so height is defined later, after ascent and descent. 1004 so height is defined later, after ascent and descent.
diff --git a/src/xfont.c b/src/xfont.c
index 83ef604d5cd..d4d6ee7c10f 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -806,7 +806,6 @@ xfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
806 ASET (font_object, FONT_FILE_INDEX, Qnil); 806 ASET (font_object, FONT_FILE_INDEX, Qnil);
807 ASET (font_object, FONT_FORMAT_INDEX, Qx); 807 ASET (font_object, FONT_FORMAT_INDEX, Qx);
808 font = XFONT_OBJECT (font_object); 808 font = XFONT_OBJECT (font_object);
809 font->frame = f;
810 ((struct xfont_info *) font)->xfont = xfont; 809 ((struct xfont_info *) font)->xfont = xfont;
811 ((struct xfont_info *) font)->display = FRAME_X_DISPLAY (f); 810 ((struct xfont_info *) font)->display = FRAME_X_DISPLAY (f);
812 font->pixel_size = pixel_size; 811 font->pixel_size = pixel_size;
diff --git a/src/xftfont.c b/src/xftfont.c
index 6423f8e19b3..37b33b3ead8 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -365,7 +365,6 @@ xftfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
365 ASET (font_object, FONT_FORMAT_INDEX, 365 ASET (font_object, FONT_FORMAT_INDEX,
366 ftfont_font_format (xftfont->pattern, filename)); 366 ftfont_font_format (xftfont->pattern, filename));
367 font = XFONT_OBJECT (font_object); 367 font = XFONT_OBJECT (font_object);
368 font->frame = f;
369 font->pixel_size = size; 368 font->pixel_size = size;
370 font->driver = &xftfont_driver; 369 font->driver = &xftfont_driver;
371 font->encoding_charset = font->repertory_charset = -1; 370 font->encoding_charset = font->repertory_charset = -1;