From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#23386: Segfault when messing with font-backend Date: Mon, 11 Jul 2016 17:33:29 +0300 Message-ID: <831t30dz2e.fsf@gnu.org> References: <83y47zxi81.fsf@gnu.org> <87d1mmiq35.fsf@users.sourceforge.net> <73cd86e5-3c92-cb6a-3a7b-1a5ec82c05de@yandex.ru> <87a8hpgseb.fsf@users.sourceforge.net> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1468247733 25458 80.91.229.3 (11 Jul 2016 14:35:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 11 Jul 2016 14:35:33 +0000 (UTC) Cc: dmantipov@yandex.ru, monnier@IRO.UMontreal.CA, 23386@debbugs.gnu.org To: npostavs@users.sourceforge.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jul 11 16:35:22 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bMcIq-0003s4-N4 for geb-bug-gnu-emacs@m.gmane.org; Mon, 11 Jul 2016 16:35:20 +0200 Original-Received: from localhost ([::1]:34057 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMcIq-00054X-05 for geb-bug-gnu-emacs@m.gmane.org; Mon, 11 Jul 2016 10:35:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:32897) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMcIa-0004zj-0e for bug-gnu-emacs@gnu.org; Mon, 11 Jul 2016 10:35:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bMcIX-0006SJ-T3 for bug-gnu-emacs@gnu.org; Mon, 11 Jul 2016 10:35:02 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34619) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMcIX-0006SF-Pk for bug-gnu-emacs@gnu.org; Mon, 11 Jul 2016 10:35:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bMcIX-0003ZK-Le for bug-gnu-emacs@gnu.org; Mon, 11 Jul 2016 10:35:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 11 Jul 2016 14:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23386 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 23386-submit@debbugs.gnu.org id=B23386.146824764613643 (code B ref 23386); Mon, 11 Jul 2016 14:35:01 +0000 Original-Received: (at 23386) by debbugs.gnu.org; 11 Jul 2016 14:34:06 +0000 Original-Received: from localhost ([127.0.0.1]:46956 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bMcHe-0003Xz-0Z for submit@debbugs.gnu.org; Mon, 11 Jul 2016 10:34:06 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:41480) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bMcHZ-0003XP-KO for 23386@debbugs.gnu.org; Mon, 11 Jul 2016 10:34:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bMcHN-000626-4f for 23386@debbugs.gnu.org; Mon, 11 Jul 2016 10:33:53 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:48222) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bMcHN-000620-1O; Mon, 11 Jul 2016 10:33:49 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3809 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bMcHL-0006vn-Qz; Mon, 11 Jul 2016 10:33:48 -0400 In-reply-to: <87a8hpgseb.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:120845 Archived-At: > From: npostavs@users.sourceforge.net > Date: Sun, 10 Jul 2016 16:17:00 -0400 > Cc: Stefan Monnier , 23386@debbugs.gnu.org > > Dmitry Antipov writes: > > > IMHO the original trick (request to drop font backend when there is a font > > opened by using this backend) is practically meaningless, so why just not > > prohibit it explicitly? For example, with: > > Maybe that is a better idea; it does prevent the segfault, and it's > certainly simpler. But it doesn't do what the user asked for. I don't see why it would be meaningless to evict a backend and start using another one, if all it takes is re-open a bunch of fonts. So I'm in favor of Noam's proposal, assuming that it works. Noam, I encourage you to dig some more into this "forest", until you convince yourself that the patch is sound. While at that, please consider adding comments where you learn useful things that are not trivial to understand from the code alone, as this area of Emacs sources is notoriously under-documented. One issue that bothers me is this: what if additional fonts were already opened for non-default faces? Should they also get some treatment? (This is relevant to Dmitry's suggestion as well.) I have one comment about your patch: > diff --git a/src/xfns.c b/src/xfns.c > index 7c1bb1c..1b9dd48 100644 > --- a/src/xfns.c > +++ b/src/xfns.c > @@ -3071,7 +3071,7 @@ do_unwind_create_frame (Lisp_Object frame) > unwind_create_frame (frame); > } > > -static void > +void > x_default_font_parameter (struct frame *f, Lisp_Object parms) > { > struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); This cannot be done only in xfns.c, as it will then break the other platforms, because x_set_font_backend is not specific to X. Thanks.