aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Antipov2014-09-22 09:34:05 +0400
committerDmitry Antipov2014-09-22 09:34:05 +0400
commitfc5ebc3f497a152132407d57a14cce147d59d29c (patch)
tree7b425f628ecbcf6561a1fbb5c4e5014f9cf3a3e9
parent63126683dbcf3ac507c3afd20ecbce88fb6e0fa4 (diff)
downloademacs-fc5ebc3f497a152132407d57a14cce147d59d29c.tar.gz
emacs-fc5ebc3f497a152132407d57a14cce147d59d29c.zip
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.
-rw-r--r--src/ChangeLog6
-rw-r--r--src/macfont.m31
2 files changed, 24 insertions, 13 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 684de498522..4d969d73279 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12014-09-22 Dmitry Antipov <dmantipov@yandex.ru>
2
3 On OSX, do not free font-specific data more than once (Bug#18501).
4 * macfont.m (macfont_close): Release and free font-specific data
5 only if it wasn't previously freed.
6
12014-09-21 David Caldwell <david@porkrind.org> (tiny change) 72014-09-21 David Caldwell <david@porkrind.org> (tiny change)
2 8
3 * unexmacosx.c (dump_it): Improve error message. 9 * unexmacosx.c (dump_it): Improve error message.
diff --git a/src/macfont.m b/src/macfont.m
index 1bb3fb14134..69bde9f66a7 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -2616,20 +2616,25 @@ static void
2616macfont_close (struct font *font) 2616macfont_close (struct font *font)
2617{ 2617{
2618 struct macfont_info *macfont_info = (struct macfont_info *) font; 2618 struct macfont_info *macfont_info = (struct macfont_info *) font;
2619 int i;
2620 2619
2621 block_input (); 2620 if (macfont_info->cache)
2622 CFRelease (macfont_info->macfont); 2621 {
2623 CGFontRelease (macfont_info->cgfont); 2622 int i;
2624 if (macfont_info->screen_font) 2623
2625 CFRelease (macfont_info->screen_font); 2624 block_input ();
2626 macfont_release_cache (macfont_info->cache); 2625 CFRelease (macfont_info->macfont);
2627 for (i = 0; i < macfont_info->metrics_nrows; i++) 2626 CGFontRelease (macfont_info->cgfont);
2628 if (macfont_info->metrics[i]) 2627 if (macfont_info->screen_font)
2629 xfree (macfont_info->metrics[i]); 2628 CFRelease (macfont_info->screen_font);
2630 if (macfont_info->metrics) 2629 macfont_release_cache (macfont_info->cache);
2631 xfree (macfont_info->metrics); 2630 for (i = 0; i < macfont_info->metrics_nrows; i++)
2632 unblock_input (); 2631 if (macfont_info->metrics[i])
2632 xfree (macfont_info->metrics[i]);
2633 if (macfont_info->metrics)
2634 xfree (macfont_info->metrics);
2635 macfont_info->cache = NULL;
2636 unblock_input ();
2637 }
2633} 2638}
2634 2639
2635static int 2640static int