From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Liam Quinlan Newsgroups: gmane.emacs.devel Subject: Re: --with-cairo Emacs server crash and fix Date: Tue, 13 Aug 2019 13:36:23 -0400 Message-ID: References: <83pnld8imb.fsf@gnu.org> <83v9v2s4kf.fsf@gnu.org> <83mugdrtz6.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000000dd9a8059003154b" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="84111"; mail-complaints-to="usenet@blaine.gmane.org" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 13 19:37:09 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hxajN-000LlK-0o for ged-emacs-devel@m.gmane.org; Tue, 13 Aug 2019 19:37:09 +0200 Original-Received: from localhost ([::1]:54582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hxajL-000392-D5 for ged-emacs-devel@m.gmane.org; Tue, 13 Aug 2019 13:37:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37660) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hxaiv-00038l-4Z for emacs-devel@gnu.org; Tue, 13 Aug 2019 13:36:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hxait-00054W-PA for emacs-devel@gnu.org; Tue, 13 Aug 2019 13:36:41 -0400 Original-Received: from mail-ot1-x32f.google.com ([2607:f8b0:4864:20::32f]:35143) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hxair-00053Q-TO; Tue, 13 Aug 2019 13:36:38 -0400 Original-Received: by mail-ot1-x32f.google.com with SMTP id g17so24695230otl.2; Tue, 13 Aug 2019 10:36:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=EnSbTpV8jac6CILgavVFNowmA6dZPAct0j4NBntx0RI=; b=YSh2Axdut4gFrq/xzGdBOa0sWgztY2nyOWnkPeGS6dIqt/P+vSjrTXzVet2Gux29YL XQtegfD14YYC1IUr/iNuVimq5A9uzoIhvEfj8hHBXY+gq2pJxImaZR4PsIVf36n8TciO G7IV6ykQicD1yGIKL+GYMmPRghrMnMca/b4SIXiXw36ghrvES01K0UTA7osQkB7sJP5k 2vp4VjWqqlh+a6eXAH6jtVcUiWuyRT7sTe/06wlHwmrSM6vkJHney5ePS5sr8HRtNWpi sQphZRBBe9mEyjKT/HESCvbfebp69KWvz1mKzjNOaFsQG8YsRg152EbQdTbSRN8oZETX uV2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=EnSbTpV8jac6CILgavVFNowmA6dZPAct0j4NBntx0RI=; b=Axk8fK3/IxdW9Ep6ZmbCi0CC5DRCqxDRJzJTdLbMGc7OWwjwh9XUApIVBY75Qz+Ywp qMkGo2RWdYzp5FHA+h2LHs8V/3rZiHFgFvRq+9ncl0Fu3QNZqe9LuSsbgFPY+NnfNblz rEkFzdV3bmJ6O7FgVzqAgv0v2C/mpbAioz1NQH25u8lE3QFlUvBfqxHPDFqCzPmNtUqP oksJhsHGA40BvUZ9JetMziFTqYbIXbzfgtYRaxLEgA54s6BzPMXtD6HgaSvo1I3GcjQF p/BmteVMKZnpnqISNiXxozigVU4y4dDak8DXwSnR6ydnOsRCXogRieKLdyy1APc1Nmnw 0BPA== X-Gm-Message-State: APjAAAVauGjR4Y7bywU9+rhZPGYL3st4qGp+bM8CsFnpADUHIITCXqko 3SeZwxu/E13t4kbo/DngD/otBDZkqppEnTqEPKnKyQ== X-Google-Smtp-Source: APXvYqzWupRud80r0aj6UToWGQOukQh3ilM0ftBgkycnJ1k8DT/PkLEqyMZ4JvWF14u1Oi5gaj5AY87pzbpWbcf9Kk4= X-Received: by 2002:a02:5246:: with SMTP id d67mr37984525jab.58.1565717796081; Tue, 13 Aug 2019 10:36:36 -0700 (PDT) In-Reply-To: <83mugdrtz6.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::32f X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:239347 Archived-At: --0000000000000dd9a8059003154b Content-Type: text/plain; charset="UTF-8" Alright cool. I'll have a look at your changes for comparison. Thanks for the explanation. On Tue, Aug 13, 2019, 11:00 Eli Zaretskii, wrote: > > From: Liam Quinlan > > Date: Mon, 12 Aug 2019 22:52:31 -0400 > > Cc: emacs-devel@gnu.org > > > > Update: i think I've found the actual proper solution. Alternative > patch on offer below; this time by checking for > > dynamic bitmaps already in place after finishing the static ones in > x_cr_init_fringe. Note that that function also > > defines w32_init_fringe if HAVE_NTGUI, so windows is covered. > > Yes, the idea is correct, but the implementation needed some tweaking, > in particular due to w32 doing things a bit differently during > startup. See commit c90975f on the master branch. > > > Trying to be minimal so this example doesn't iterate to over > fringe_bitmaps looking for sparse elements, just > > begin checking fringe_bitmaps for existing elements at the index > following the standard bitmaps leaves off and > > continue until the first null. I'm not sure if it's too bold to trust > that holes haven't had a chance to arise though. > > (perhaps if the server is initially used in console mode and packages > get unloaded before a gui client > > connects...?). > > No, we cannot assume there are no holes, you can clearly see in > destroy_fringe_bitmap that it leaves holes if the destroyed bitmap is > not the last one in the array. So we need to initialize all the > user-defined bitmaps whose pointer is not NULL. > > Btw, there's a simple way of reproducing the problem without any init > files and extra packages: > > emacs -Q -daemon > emacsclient SOME-VERSIONED-FILE-UNDER-GIT > M-x set variable RET diff-font-lock-prettify RET t RET > [modify the file and then save it] > C-x v = > > Before the change I pushed the above would fail to display the vc-diff > bitmaps on the fringe (I presume the Cairo build will crash). After > the change, the bitmaps are displayed correctly. This happens because > diff-mode is loaded before the GUI frame is created, and thus the > fringe bitmaps defined by diff-mode during loading are not completely > initialized. > > Thanks. > --0000000000000dd9a8059003154b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Alright cool.=C2=A0 I'll have a look at your changes = for comparison.=C2=A0 Thanks for the explanation.

On Tue, Aug 13, 2019, 11:0= 0 Eli Zaretskii, <eliz@gnu.org> w= rote:
> From: Liam Quinlan <<= a href=3D"mailto:liamkquinlan@gmail.com" target=3D"_blank" rel=3D"noreferre= r">liamkquinlan@gmail.com>
> Date: Mon, 12 Aug 2019 22:52:31 -0400
> Cc: emacs-devel@gnu.org
>
> Update: i think I've found the actual proper solution.=C2=A0 Alter= native patch on offer below; this time by checking for
> dynamic bitmaps already in place after finishing the static ones in x_= cr_init_fringe.=C2=A0 Note that that function also
> defines w32_init_fringe if HAVE_NTGUI, so windows is covered.

Yes, the idea is correct, but the implementation needed some tweaking,
in particular due to w32 doing things a bit differently during
startup.=C2=A0 See commit c90975f on the master branch.

> Trying to be minimal so this example doesn't iterate to over fring= e_bitmaps looking for sparse elements, just
> begin checking fringe_bitmaps for existing elements at the index follo= wing the standard bitmaps leaves off and
> continue until the first null.=C2=A0 I'm not sure if it's too = bold to trust that holes haven't had a chance to arise though.
> (perhaps if the server is initially used in console mode and packages = get unloaded before a gui client
> connects...?).

No, we cannot assume there are no holes, you can clearly see in
destroy_fringe_bitmap that it leaves holes if the destroyed bitmap is
not the last one in the array.=C2=A0 So we need to initialize all the
user-defined bitmaps whose pointer is not NULL.

Btw, there's a simple way of reproducing the problem without any init files and extra packages:

=C2=A0 emacs -Q -daemon
=C2=A0 emacsclient SOME-VERSIONED-FILE-UNDER-GIT
=C2=A0 M-x set variable RET diff-font-lock-prettify RET t RET
=C2=A0 [modify the file and then save it]
=C2=A0 C-x v =3D

Before the change I pushed the above would fail to display the vc-diff
bitmaps on the fringe (I presume the Cairo build will crash).=C2=A0 After the change, the bitmaps are displayed correctly.=C2=A0 This happens because=
diff-mode is loaded before the GUI frame is created, and thus the
fringe bitmaps defined by diff-mode during loading are not completely
initialized.

Thanks.
--0000000000000dd9a8059003154b--