emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r115506: * alloc.c, font.c, font.h, ftfont.c, ftxfon


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r115506: * alloc.c, font.c, font.h, ftfont.c, ftxfont.c, macfont.m,
Date: Fri, 13 Dec 2013 15:56:10 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115506
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Fri 2013-12-13 19:55:23 +0400
message:
  * 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.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/alloc.c                    alloc.c-20091113204419-o5vbwnq5f7feedwu-252
  src/font.c                     font.c-20091113204419-o5vbwnq5f7feedwu-8540
  src/font.h                     font.h-20091113204419-o5vbwnq5f7feedwu-8541
  src/ftfont.c                   ftfont.c-20091113204419-o5vbwnq5f7feedwu-8542
  src/ftxfont.c                  ftxfont.c-20091113204419-o5vbwnq5f7feedwu-8544
  src/macfont.m                  macfont.m-20130915173740-04lgloz0557bz98l-2
  src/nsfont.m                   nsfont.m-20091113204419-o5vbwnq5f7feedwu-8748
  src/w32font.c                  w32font.c-20091113204419-o5vbwnq5f7feedwu-8545
  src/xfont.c                    xfont.c-20091113204419-o5vbwnq5f7feedwu-8547
  src/xftfont.c                  xftfont.c-20091113204419-o5vbwnq5f7feedwu-8548
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-12-13 13:34:05 +0000
+++ b/src/ChangeLog     2013-12-13 15:55:23 +0000
@@ -1,5 +1,12 @@
 2013-12-13  Dmitry Antipov  <address@hidden>
 
+       * 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  <address@hidden>
+
        * font.c (font_close_object): Check for live frame (Bug#16128).
 
 2013-12-13  Paul Eggert  <address@hidden>

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2013-12-12 14:26:06 +0000
+++ b/src/alloc.c       2013-12-13 15:55:23 +0000
@@ -2874,22 +2874,10 @@
 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.  */

=== modified file 'src/font.c'
--- a/src/font.c        2013-12-13 13:34:05 +0000
+++ b/src/font.c        2013-12-13 15:55:23 +0000
@@ -173,9 +173,6 @@
        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 @@
 }
 
 
-/* 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_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 ("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 @@
   /* 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;
 }

=== modified file 'src/font.h'
--- a/src/font.h        2013-12-12 14:26:06 +0000
+++ b/src/font.h        2013-12-13 15:55:23 +0000
@@ -265,9 +265,6 @@
 {
   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 @@
 
 #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 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 **,

=== modified file 'src/ftfont.c'
--- a/src/ftfont.c      2013-12-12 14:26:06 +0000
+++ b/src/ftfont.c      2013-12-13 15:55:23 +0000
@@ -1236,7 +1236,6 @@
   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);

=== modified file 'src/ftxfont.c'
--- a/src/ftxfont.c     2013-12-12 14:26:06 +0000
+++ b/src/ftxfont.c     2013-12-13 15:55:23 +0000
@@ -255,7 +255,6 @@
   if (NILP (font_object))
     return Qnil;
   font = XFONT_OBJECT (font_object);
-  eassert (font->frame == f);
   font->driver = &ftxfont_driver;
   return font_object;
 }

=== modified file 'src/macfont.m'
--- a/src/macfont.m     2013-12-12 14:26:06 +0000
+++ b/src/macfont.m     2013-12-13 15:55:23 +0000
@@ -882,7 +882,6 @@
   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 @@
     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;

=== modified file 'src/nsfont.m'
--- a/src/nsfont.m      2013-12-12 14:26:06 +0000
+++ b/src/nsfont.m      2013-12-13 15:55:23 +0000
@@ -805,7 +805,6 @@
       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);
 

=== modified file 'src/w32font.c'
--- a/src/w32font.c     2013-12-12 14:26:06 +0000
+++ b/src/w32font.c     2013-12-13 15:55:23 +0000
@@ -999,7 +999,6 @@
        = 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.

=== modified file 'src/xfont.c'
--- a/src/xfont.c       2013-12-12 14:26:06 +0000
+++ b/src/xfont.c       2013-12-13 15:55:23 +0000
@@ -806,7 +806,6 @@
   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;

=== modified file 'src/xftfont.c'
--- a/src/xftfont.c     2013-12-12 14:26:06 +0000
+++ b/src/xftfont.c     2013-12-13 15:55:23 +0000
@@ -365,7 +365,6 @@
   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;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]