all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Stefan Husmann <stefan-husmann@t-online.de>, 34051@debbugs.gnu.org
Subject: bug#34051: 27.0.50; Emacs 27 from master segfaults
Date: Tue, 15 Jan 2019 16:52:32 +0000	[thread overview]
Message-ID: <20190115165232.GB31959@breton.holly.idiocy.org> (raw)
In-Reply-To: <83sgxweg26.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 320 bytes --]

On Sun, Jan 13, 2019 at 05:24:33PM +0200, Eli Zaretskii wrote:
> Strange, it looks like it dies in x_parse_color.  Alan, can you
> reproduce this?

These X server errors are asynchronous and not very helpful. The most
likely culprit is x_create_x_image_and_pixmap.

Stefan, please try the attached patch.
-- 
Alan Third

[-- Attachment #2: 0001-Be-more-specific-with-XRender-bit-depths-bug-34051.patch --]
[-- Type: text/plain, Size: 2326 bytes --]

From 254097a0aadb252f9223e1d133132a01b459bc7d Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
Date: Tue, 15 Jan 2019 16:38:34 +0000
Subject: [PATCH] Be more specific with XRender bit-depths (bug#34051)

* src/image.c (x_create_x_image_and_pixmap): Fail gracefully if a bit
depth is requested that XRender doesn't support.
---
 src/image.c | 32 +++++++++++++++++++++++---------
 1 file changed, 23 insertions(+), 9 deletions(-)

diff --git a/src/image.c b/src/image.c
index 2fae105815..3f5def2350 100644
--- a/src/image.c
+++ b/src/image.c
@@ -2178,15 +2178,29 @@ x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth,
   int event_basep, error_basep;
   if (picture && XRenderQueryExtension (display, &event_basep, &error_basep))
     {
-      XRenderPictFormat *format;
-      XRenderPictureAttributes attr;
-
-      /* FIXME: Do we need to handle all possible bit depths?  */
-      format = XRenderFindStandardFormat (display,
-                                          depth > 24 ? PictStandardARGB32
-                                          : depth > 8 ? PictStandardRGB24
-                                          : PictStandardA8);
-      *picture = XRenderCreatePicture (display, *pixmap, format, 0, &attr);
+      if (depth == 32 || depth == 24 || depth == 8)
+        {
+          XRenderPictFormat *format;
+          XRenderPictureAttributes attr;
+
+          /* FIXME: Do we need to handle all possible bit depths?
+             XRenderFindStandardFormat supports PictStandardARGB32,
+             PictStandardRGB24, PictStandardA8, PictStandardA4,
+             PictStandardA1, and PictStandardNUM (what is this?!).
+
+             XRenderFindFormat may support more, but I don't
+             understand the documentation.  */
+          format = XRenderFindStandardFormat (display,
+                                              depth == 32 ? PictStandardARGB32
+                                              : depth == 24 ? PictStandardRGB24
+                                              : PictStandardA8);
+          *picture = XRenderCreatePicture (display, *pixmap, format, 0, &attr);
+        }
+      else
+        {
+          image_error ("Specified bit depth is not supported by XRender");
+          *picture = NULL;
+        }
     }
 # endif
 
-- 
2.19.1


  reply	other threads:[~2019-01-15 16:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-14 15:08 "X protocol error: BadMatch" on current master Yuri D'Elia
2019-01-14 16:12 ` Eli Zaretskii
2019-01-12 15:46   ` bug#34051: 27.0.50; Emacs 27 from master segfaults stefan-husmann
2019-01-12 16:15     ` Eli Zaretskii
     [not found]       ` <87sgxxwtbs.fsf@frege.i-did-not-set--mail-host-address--so-tickle-me>
2019-01-12 20:22         ` Eli Zaretskii
2019-01-13 11:20           ` Stefan Husmann
2019-01-13 15:24             ` Eli Zaretskii
2019-01-15 16:52               ` Alan Third [this message]
2019-01-16 21:22     ` bug#34051: "X protocol error: BadMatch" on current master Yuri D'Elia
2019-01-16 21:28       ` Yuri D'Elia
2019-01-17 13:36       ` Eli Zaretskii
2019-01-17 17:39         ` Alan Third
2019-01-17 17:44           ` Yuri D'Elia
2019-01-17 17:50             ` Alan Third
2019-01-17  0:18     ` bug#34051: 27.0.50; Emacs 27 from master segfaults Katsumi Yamaoka
2019-01-17 17:42       ` Alan Third

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190115165232.GB31959@breton.holly.idiocy.org \
    --to=alan@idiocy.org \
    --cc=34051@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=stefan-husmann@t-online.de \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.