emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r114797: Perform font-specific cleanup when font obj


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r114797: Perform font-specific cleanup when font object is swept by GC. See
Date: Fri, 25 Oct 2013 07:31:26 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114797
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Fri 2013-10-25 11:28:16 +0400
message:
  Perform font-specific cleanup when font object is swept by GC.  See
  http://lists.gnu.org/archive/html/emacs-devel/2013-10/msg00740.html.
  * alloc.c (cleanup_vector): New function.
  (sweep_vector): Call it for each reclaimed vector object.
  * font.h (struct font): Adjust comment.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/alloc.c                    alloc.c-20091113204419-o5vbwnq5f7feedwu-252
  src/font.h                     font.h-20091113204419-o5vbwnq5f7feedwu-8541
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-10-25 06:55:36 +0000
+++ b/src/ChangeLog     2013-10-25 07:28:16 +0000
@@ -9,9 +9,15 @@
        * nsfont.m (nsfont_close):
        * w32font.c (w32font_close):
        * xfont.c (xfont_close):
-       * xftfont.c (xftfont_close): Adjust driver-specific close
-       functions, tweak comments and make functions safe if called
-       more than once for the same font object.
+       * xftfont.c (xftfont_close): Adjust driver-specific close functions,
+       tweak comments and make functions safe if called more than once for
+       the same font object.
+
+       Perform font-specific cleanup when font object is swept by GC.  See
+       http://lists.gnu.org/archive/html/emacs-devel/2013-10/msg00740.html.
+       * alloc.c (cleanup_vector): New function.
+       (sweep_vector): Call it for each reclaimed vector object.
+       * font.h (struct font): Adjust comment.
 
 2013-10-24  Glenn Morris  <address@hidden>
 

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2013-10-23 16:07:30 +0000
+++ b/src/alloc.c       2013-10-25 07:28:16 +0000
@@ -2837,6 +2837,19 @@
   return vroundup (size);
 }
 
+/* Release extra resources still in use by VECTOR, which may be any
+   vector-like object.  For now, this is used just to free data in
+   font objects.  */
+
+static void
+cleanup_vector (struct Lisp_Vector *vector)
+{
+  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.  */
 
 static void
@@ -2871,6 +2884,7 @@
            {
              ptrdiff_t total_bytes;
 
+             cleanup_vector (vector);
              nbytes = vector_nbytes (vector);
              total_bytes = nbytes;
              next = ADVANCE (vector, nbytes);
@@ -2882,6 +2896,7 @@
                {
                  if (VECTOR_MARKED_P (next))
                    break;
+                 cleanup_vector (next);
                  nbytes = vector_nbytes (next);
                  total_bytes += nbytes;
                  next = ADVANCE (next, nbytes);

=== modified file 'src/font.h'
--- a/src/font.h        2013-10-25 06:55:36 +0000
+++ b/src/font.h        2013-10-25 07:28:16 +0000
@@ -545,7 +545,7 @@
   Lisp_Object (*open) (struct frame *f, Lisp_Object font_entity,
                        int pixel_size);
 
-  /* Close FONT.  */
+  /* Close FONT.  NOTE: this can be called by GC.  */
   void (*close) (struct font *font);
 
   /* Optional (if FACE->extra is not used).


reply via email to

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