emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-24 r117514: On OSX, do not free font-specific data m


From: Dmitry Antipov
Subject: [Emacs-diffs] emacs-24 r117514: On OSX, do not free font-specific data more than once (Bug#18501).
Date: Mon, 22 Sep 2014 05:34:44 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117514
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: emacs-24
timestamp: Mon 2014-09-22 09:34:05 +0400
message:
  On OSX, do not free font-specific data more than once (Bug#18501).
  * macfont.m (macfont_close): Release and free font-specific data
  only if it wasn't previously freed.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/macfont.m                  macfont.m-20130915173740-04lgloz0557bz98l-2
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-09-21 20:35:22 +0000
+++ b/src/ChangeLog     2014-09-22 05:34:05 +0000
@@ -1,3 +1,9 @@
+2014-09-22  Dmitry Antipov  <address@hidden>
+
+       On OSX, do not free font-specific data more than once (Bug#18501).
+       * macfont.m (macfont_close): Release and free font-specific data
+       only if it wasn't previously freed.
+
 2014-09-21  David Caldwell <address@hidden> (tiny change)
 
        * unexmacosx.c (dump_it): Improve error message.

=== modified file 'src/macfont.m'
--- a/src/macfont.m     2014-07-20 13:18:47 +0000
+++ b/src/macfont.m     2014-09-22 05:34:05 +0000
@@ -2616,20 +2616,25 @@
 macfont_close (struct font *font)
 {
   struct macfont_info *macfont_info = (struct macfont_info *) font;
-  int i;
-
-  block_input ();
-  CFRelease (macfont_info->macfont);
-  CGFontRelease (macfont_info->cgfont);
-  if (macfont_info->screen_font)
-    CFRelease (macfont_info->screen_font);
-  macfont_release_cache (macfont_info->cache);
-  for (i = 0; i < macfont_info->metrics_nrows; i++)
-    if (macfont_info->metrics[i])
-      xfree (macfont_info->metrics[i]);
-  if (macfont_info->metrics)
-    xfree (macfont_info->metrics);
-  unblock_input ();
+
+  if (macfont_info->cache)
+    {
+      int i;
+
+      block_input ();
+      CFRelease (macfont_info->macfont);
+      CGFontRelease (macfont_info->cgfont);
+      if (macfont_info->screen_font)
+       CFRelease (macfont_info->screen_font);
+      macfont_release_cache (macfont_info->cache);
+      for (i = 0; i < macfont_info->metrics_nrows; i++)
+       if (macfont_info->metrics[i])
+         xfree (macfont_info->metrics[i]);
+      if (macfont_info->metrics)
+       xfree (macfont_info->metrics);
+      macfont_info->cache = NULL;
+      unblock_input ();
+    }
 }
 
 static int


reply via email to

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