1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-22 07:09:54 +00:00

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.
This commit is contained in:
Dmitry Antipov 2014-09-22 09:34:05 +04:00
parent 63126683db
commit fc5ebc3f49
2 changed files with 24 additions and 13 deletions

View File

@ -1,3 +1,9 @@
2014-09-22 Dmitry Antipov <dmantipov@yandex.ru>
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 <david@porkrind.org> (tiny change)
* unexmacosx.c (dump_it): Improve error message.

View File

@ -2616,20 +2616,25 @@ So we use CTFontDescriptorCreateMatchingFontDescriptor (no
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