]> git.eshelyaron.com Git - emacs.git/commitdiff
* alloc.c, font.c, font.h, ftfont.c, ftxfont.c, macfont.m,
authorDmitry Antipov <dmantipov@yandex.ru>
Fri, 13 Dec 2013 15:55:23 +0000 (19:55 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Fri, 13 Dec 2013 15:55:23 +0000 (19:55 +0400)
* 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.

src/ChangeLog
src/alloc.c
src/font.c
src/font.h
src/ftfont.c
src/ftxfont.c
src/macfont.m
src/nsfont.m
src/w32font.c
src/xfont.c
src/xftfont.c

index 2ae2f99b49a8e0421a808b47847e0137d48c8712..4e8285e95308c7d2d14f80d379e57403f40cbe71 100644 (file)
@@ -1,3 +1,10 @@
+2013-12-13  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * 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.
+
 2013-12-13  Dmitry Antipov  <dmantipov@yandex.ru>
 
        * font.c (font_close_object): Check for live frame (Bug#16128).
index 022d1e5dcbb8dd8467b8d7f1609982e0ab1ea30d..aeda42637cde8ee5688d55fbe7c0da89191d21d6 100644 (file)
@@ -2874,22 +2874,10 @@ vector_nbytes (struct Lisp_Vector *v)
 static void
 cleanup_vector (struct Lisp_Vector *vector)
 {
-  if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_FONT))
-    {
-      ptrdiff_t size = vector->header.size & PSEUDOVECTOR_SIZE_MASK;
-      Lisp_Object obj = make_lisp_ptr (vector, Lisp_Vectorlike);
-
-      if (size == FONT_OBJECT_MAX)
-       font_close_object (obj);
-#ifdef HAVE_NS
-      else if (size == FONT_ENTITY_MAX)
-       {
-         struct font_entity *entity = (struct font_entity *) vector;
-         if (entity->driver && entity->driver->free_entity)
-           entity->driver->free_entity (obj);
-       }
-#endif /* HAVE_NS */
-    }
+  if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_FONT)
+      && ((vector->header.size & PSEUDOVECTOR_SIZE_MASK)
+         == FONT_OBJECT_MAX))
+    ((struct font *) vector)->driver->close ((struct font *) vector);
 }
 
 /* Reclaim space used by unmarked vectors.  */
index 9f284440143a5690ec32267358dc130b1f362163..fb56b3d3fb3a37a3ce60f805f47a1160de9c53d0 100644 (file)
@@ -173,9 +173,6 @@ font_make_entity (void)
        allocate_pseudovector (VECSIZE (struct font_entity),
                              FONT_ENTITY_MAX, PVEC_FONT));
   XSETFONT (font_entity, entity);
-#ifdef HAVE_NS
-  entity->driver = NULL;
-#endif
   return font_entity;
 }
 
@@ -2884,10 +2881,10 @@ font_open_entity (struct frame *f, Lisp_Object entity, int pixel_size)
 }
 
 
-/* Close FONT_OBJECT.  */
+/* Close FONT_OBJECT that is opened on frame F.  */
 
-void
-font_close_object (Lisp_Object font_object)
+static void
+font_close_object (struct frame *f, Lisp_Object font_object)
 {
   struct font *font = XFONT_OBJECT (font_object);
 
@@ -2897,13 +2894,8 @@ font_close_object (Lisp_Object font_object)
   FONT_ADD_LOG ("close", font_object, Qnil);
   font->driver->close (font);
 #ifdef HAVE_WINDOW_SYSTEM
-  eassert (font->frame);
-  /* If the frame is gone, we can't do anything (Bug#16128).  */
-  if (FRAME_LIVE_P (font->frame))
-    {
-      eassert (FRAME_DISPLAY_INFO (font->frame)->n_fonts);
-      FRAME_DISPLAY_INFO (font->frame)->n_fonts--;
-    }
+  eassert (FRAME_DISPLAY_INFO (f)->n_fonts);
+  FRAME_DISPLAY_INFO (f)->n_fonts--;
 #endif
 }
 
@@ -4556,11 +4548,11 @@ DEFUN ("open-font", Fopen_font, Sopen_font, 1, 3, 0,
 }
 
 DEFUN ("close-font", Fclose_font, Sclose_font, 1, 2, 0,
-       doc: /* Close FONT-OBJECT.  Optional FRAME is unused.  */)
+       doc: /* Close FONT-OBJECT.  */)
   (Lisp_Object font_object, Lisp_Object frame)
 {
   CHECK_FONT_OBJECT (font_object);
-  font_close_object (font_object);
+  font_close_object (decode_live_frame (frame), font_object);
   return Qnil;
 }
 
@@ -4895,7 +4887,7 @@ If the named font is not yet loaded, return nil.  */)
   /* As font_object is still in FONT_OBJLIST of the entity, we can't
      close it now.  Perhaps, we should manage font-objects
      by `reference-count'.  */
-  font_close_object (font_object);
+  font_close_object (f, font_object);
 #endif
   return info;
 }
index 7781816860a6aa5d83c8be0c81fd8356eda9733e..539ebeba52a395167b245aaad884e22909a25365 100644 (file)
@@ -265,9 +265,6 @@ struct font_entity
 {
   struct vectorlike_header header;
   Lisp_Object props[FONT_ENTITY_MAX];
-#ifdef HAVE_NS
-  struct font_driver *driver;
-#endif
 };
 
 /* A value which may appear in the member `encoding' of struct font
@@ -319,9 +316,6 @@ struct font
 
 #if defined (HAVE_WINDOW_SYSTEM)
 
-  /* The frame where the font was opened.  */
-  struct frame *frame;
-
   /* Vertical pixel width of the underline.  If is zero if that
      information is not in the font.  */
   int underline_thickness;
@@ -741,7 +735,6 @@ extern Lisp_Object merge_font_spec (Lisp_Object, Lisp_Object);
 
 extern Lisp_Object font_make_entity (void);
 extern Lisp_Object font_make_object (int, Lisp_Object, int);
-extern void font_close_object (Lisp_Object);
 
 extern Lisp_Object find_font_encoding (Lisp_Object);
 extern int font_registry_charsets (Lisp_Object, struct charset **,
index 36780454257ba50837fb6907b0bc4d493ea810a7..6a2303ab4a7c788be71fc67875487c23b2aecd12 100644 (file)
@@ -1236,7 +1236,6 @@ ftfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
   ASET (font_object, FONT_FILE_INDEX, filename);
   ASET (font_object, FONT_FORMAT_INDEX, ftfont_font_format (NULL, filename));
   font = XFONT_OBJECT (font_object);
-  font->frame = f;
   ftfont_info = (struct ftfont_info *) font;
   ftfont_info->ft_size = ft_face->size;
   ftfont_info->index = XINT (idx);
index b44905d88cdaa99337a01844e176267526e6ddbe..d1aa3e404037c9d5602054a5e22a60d38794913c 100644 (file)
@@ -255,7 +255,6 @@ ftxfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
   if (NILP (font_object))
     return Qnil;
   font = XFONT_OBJECT (font_object);
-  eassert (font->frame == f);
   font->driver = &ftxfont_driver;
   return font_object;
 }
index 66833cd1b8073cc1ca075e9b80e4ab00354a278c..10623eb12fea4772ce766f4e7a7bba9103d418d4 100644 (file)
@@ -882,7 +882,6 @@ macfont_descriptor_entity (FontDescriptorRef desc, Lisp_Object extra,
   CFStringRef name;
 
   entity = font_make_entity ();
-  XFONT_ENTITY (entity)->driver = &macfont_driver;
 
   ASET (entity, FONT_TYPE_INDEX, macfont_driver.type);
   ASET (entity, FONT_REGISTRY_INDEX, Qiso10646_1);
@@ -2492,7 +2491,6 @@ macfont_open (struct frame * f, Lisp_Object entity, int pixel_size)
     ASET (font_object, FONT_FULLNAME_INDEX,
          AREF (font_object, FONT_NAME_INDEX));
   font = XFONT_OBJECT (font_object);
-  font->frame = f;
   font->pixel_size = size;
   font->driver = &macfont_driver;
   font->encoding_charset = font->repertory_charset = -1;
index a794c9eed4121e39450a183c3c046af61912c162..0f546408316d8908b48c66628c247100f647107b 100644 (file)
@@ -805,7 +805,6 @@ nsfont_open (struct frame *f, Lisp_Object font_entity, int pixel_size)
       return Qnil; /* FIXME: other terms do, but return Qnil causes segfault */
     }
 
-  font->frame = f;
   font_info->glyphs = xzalloc (0x100 * sizeof *font_info->glyphs);
   font_info->metrics = xzalloc (0x100 * sizeof *font_info->metrics);
 
index 204692749697d6ab9cc99a600262d9dbcd827a83..654e0d9cae40c0fdfff40975f7feae7d6a88b3c5 100644 (file)
@@ -999,7 +999,6 @@ w32font_open_internal (struct frame *f, Lisp_Object font_entity,
        = DECODE_SYSTEM (build_string (logfont.lfFaceName));
   }
 
-  font->frame = f;
   font->max_width = w32_font->metrics.tmMaxCharWidth;
   /* Parts of Emacs display assume that height = ascent + descent...
      so height is defined later, after ascent and descent.
index 83ef604d5cd782a2fd609abd9228ba76cd3441a2..d4d6ee7c10fe1dd10079a5615dd6432a9d7694f8 100644 (file)
@@ -806,7 +806,6 @@ xfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
   ASET (font_object, FONT_FILE_INDEX, Qnil);
   ASET (font_object, FONT_FORMAT_INDEX, Qx);
   font = XFONT_OBJECT (font_object);
-  font->frame = f;
   ((struct xfont_info *) font)->xfont = xfont;
   ((struct xfont_info *) font)->display = FRAME_X_DISPLAY (f);
   font->pixel_size = pixel_size;
index 6423f8e19b3081cf3f8063b91e3734bf836df767..37b33b3ead8cf9d39a7f97b25617a5a9b513f60c 100644 (file)
@@ -365,7 +365,6 @@ xftfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
   ASET (font_object, FONT_FORMAT_INDEX,
        ftfont_font_format (xftfont->pattern, filename));
   font = XFONT_OBJECT (font_object);
-  font->frame = f;
   font->pixel_size = size;
   font->driver = &xftfont_driver;
   font->encoding_charset = font->repertory_charset = -1;