From: Dmitry Antipov <dmantipov@yandex.ru>
To: Jim Radford <radford@blackbean.org>
Cc: 18501@debbugs.gnu.org
Subject: bug#18501: Acknowledgement (24.3.93; OS X; crash in free() when calling macfont_close())
Date: Sat, 20 Sep 2014 05:08:15 +0400 [thread overview]
Message-ID: <541CD37F.3030802@yandex.ru> (raw)
In-Reply-To: <20140919180528.GA8843@home.blackbean.org>
[-- Attachment #1: Type: text/plain, Size: 814 bytes --]
On 09/19/2014 10:05 PM, Jim Radford wrote:
> Here are the two calls that free the font:
>
> frame #1: 0x00000001001c5ffd Emacs`macfont_close(font=0x0000000105c2a8c0) + 13 at macfont.m:2621
> frame #2: 0x000000010014de80 Emacs`font_clear_cache(f=<unavailable>, cache=<unavailable>, driver=<unavailable>) + 304 at font.c:2620
>
> frame #1: 0x00000001001c5ffd Emacs`macfont_close(font=0x0000000105c2a8c0) + 13 at macfont.m:2621
> frame #2: 0x000000010011be9d Emacs`Fgarbage_collect [inlined] cleanup_vector + 38 at alloc.c:2935
>
> Notice that the pointer is the same in both cases. Both cleanup_vector() and font_clear_cache() call
>
> drv->close(font)
>
> It seems that font_clear_cache is leaving the font around for the GC to clean up (a second time) later.
Please try this.
Dmitry
[-- Attachment #2: bug18501.patch --]
[-- Type: text/x-diff, Size: 1278 bytes --]
=== modified file 'src/macfont.m'
--- src/macfont.m 2014-07-20 13:18:47 +0000
+++ src/macfont.m 2014-09-20 01:05:58 +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
next prev parent reply other threads:[~2014-09-20 1:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-17 23:38 bug#18501: 24.3.93; OS X; crash in free() when calling macfont_close() Jim Radford
[not found] ` <handler.18501.B.141107709331502.ack@debbugs.gnu.org>
2014-09-18 22:14 ` bug#18501: Acknowledgement (24.3.93; OS X; crash in free() when calling macfont_close()) Jim Radford
2014-09-19 17:05 ` Jim Radford
2014-09-19 18:05 ` Jim Radford
2014-09-20 1:08 ` Dmitry Antipov [this message]
2014-09-20 22:08 ` Jim Radford
2014-09-21 5:03 ` Dmitry Antipov
2014-09-21 16:58 ` Jim Radford
2014-09-22 9:52 ` YAMAMOTO Mitsuharu
2014-09-22 11:01 ` Dmitry Antipov
2016-05-25 20:38 ` Alan Third
2016-05-27 9:29 ` Eli Zaretskii
2016-05-27 18:13 ` Alan Third
2016-05-27 18:56 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=541CD37F.3030802@yandex.ru \
--to=dmantipov@yandex.ru \
--cc=18501@debbugs.gnu.org \
--cc=radford@blackbean.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).