From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#44111: 27.1; segmentation fault starting emacsclient with -n option Date: Wed, 21 Oct 2020 18:35:17 +0300 Message-ID: <83mu0fmw22.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38483"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 44111@debbugs.gnu.org, nicarran@yandex.com To: Nicolas Carranza Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 21 17:37:19 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kVGAw-0009wH-W9 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 21 Oct 2020 17:37:18 +0200 Original-Received: from localhost ([::1]:52050 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVGAw-00057T-2K for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 21 Oct 2020 11:37:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVG9k-0004EP-V7 for bug-gnu-emacs@gnu.org; Wed, 21 Oct 2020 11:36:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38729) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kVG9j-0005R8-BB for bug-gnu-emacs@gnu.org; Wed, 21 Oct 2020 11:36:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kVG9j-0004xu-9D for bug-gnu-emacs@gnu.org; Wed, 21 Oct 2020 11:36:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 21 Oct 2020 15:36:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44111 X-GNU-PR-Package: emacs Original-Received: via spool by 44111-submit@debbugs.gnu.org id=B44111.160329452218985 (code B ref 44111); Wed, 21 Oct 2020 15:36:03 +0000 Original-Received: (at 44111) by debbugs.gnu.org; 21 Oct 2020 15:35:22 +0000 Original-Received: from localhost ([127.0.0.1]:50265 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kVG94-0004w9-30 for submit@debbugs.gnu.org; Wed, 21 Oct 2020 11:35:22 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:34546) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kVG92-0004vu-LQ for 44111@debbugs.gnu.org; Wed, 21 Oct 2020 11:35:21 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:51256) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVG8w-00055s-Bn; Wed, 21 Oct 2020 11:35:14 -0400 Original-Received: from [176.228.60.248] (port=2137 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kVG8q-0003OG-Fz; Wed, 21 Oct 2020 11:35:12 -0400 In-Reply-To: (message from Nicolas Carranza on Wed, 21 Oct 2020 00:07:49 -0500) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:191176 Archived-At: > From: Nicolas Carranza > Date: Wed, 21 Oct 2020 00:07:49 -0500 > Cc: nicarran@yandex.com > > I can reproduce an emacs segmentation fault following this steps on my > system: > > 1. Start emacs as daemon using: > emacs --daemon=myEmacs > > 2. Start emacsclient using: > emacsclient -s myEmacs -n -c test.org > > 3. emacs crashes: Thanks. Can you try the patch below? I've just installed it on the emacs-27 branch. diff --git a/src/xdisp.c b/src/xdisp.c index 6c401d0..03dc4be 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -22793,6 +22793,10 @@ maybe_produce_line_number (struct it *it) int lnum_face_id = merge_faces (it->w, Qline_number, 0, DEFAULT_FACE_ID); int current_lnum_face_id = merge_faces (it->w, Qline_number_current_line, 0, DEFAULT_FACE_ID); + /* From here onwards, we must prevent freeing realized faces, because + we are using the above 2 face IDs for the glyphs we produce. */ + bool save_free_realized_faces = inhibit_free_realized_faces; + inhibit_free_realized_faces = true; /* Compute point's line number if needed. */ if ((EQ (Vdisplay_line_numbers, Qrelative) || EQ (Vdisplay_line_numbers, Qvisual) @@ -22922,10 +22926,13 @@ maybe_produce_line_number (struct it *it) it->lnum_width = 0; it->lnum_pixel_width = 0; bidi_unshelve_cache (itdata, false); + inhibit_free_realized_faces = save_free_realized_faces; return; } } + inhibit_free_realized_faces = save_free_realized_faces; + /* Record the width in pixels we need for the line number display. */ it->lnum_pixel_width = tem_it.current_x; /* Copy the produced glyphs into IT's glyph_row. */