unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#56372: 29.0.50; [PATCH] Avoid BadMatch X11 error
@ 2022-07-03 14:45 dick.r.chiang
  2022-07-04  0:50 ` Katsumi Yamaoka
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: dick.r.chiang @ 2022-07-03 14:45 UTC (permalink / raw)
  To: 56372

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


With my particular font sizing, I get an X11 BadMatch (invalid parameter
attributes) error one out of every 10 starts or so.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Avoid-a-BadMatch-X11-error.patch --]
[-- Type: text/x-diff, Size: 16358 bytes --]

From 95911e85c12e91123ebc4448700f67877b4109cc Mon Sep 17 00:00:00 2001
From: dickmao <dick.r.chiang@gmail.com>
Date: Sun, 3 Jul 2022 10:34:20 -0400
Subject: [PATCH] Avoid a BadMatch X11 error

x_uncatch_errors() might do a sync that
x_ignore_errors_for_next_request() doesn't?  The details are unclear.

* src/xfaces.c (unregister_colors, compare_fonts_by_sort_order,
get_lface_attributes, lface_fully_specified_p, merge_face_vectors,
merge_named_face, merge_face_ref, Finternal_make_lisp_face,
Finternal_merge_in_global_face, lface_equal_p,
Finternal_lisp_face_empty_p, clear_face_gcs, free_realized_faces,
cache_face, lookup_named_face, lookup_derived_face,
gui_supports_face_attributes_p, Fdisplay_supports_face_attributes_p,
Finternal_set_font_selection_order, realize_named_face,
face_at_buffer_position, merge_faces, Fdump_face): C89.
* src/xterm.c (x_frame_highlight): Revert 2c4922d76b7.
(x_frame_unhighlight): Revert 2c4922d76b7.
---
 src/xfaces.c | 112 +++++++++++++++++++++------------------------------
 src/xterm.c  |  18 ++-------
 2 files changed, 51 insertions(+), 79 deletions(-)

diff --git a/src/xfaces.c b/src/xfaces.c
index 8ae922578ec..c0d8e2e740c 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -440,8 +440,7 @@ unregister_color (unsigned long pixel)
 void
 unregister_colors (unsigned long *pixels, int n)
 {
-  int i;
-  for (i = 0; i < n; ++i)
+  for (int i = 0; i < n; ++i)
     unregister_color (pixels[i]);
 }
 
@@ -1471,9 +1470,8 @@ compare_fonts_by_sort_order (const void *v1, const void *v2)
   Lisp_Object const *p2 = v2;
   Lisp_Object font1 = *p1;
   Lisp_Object font2 = *p2;
-  int i;
 
-  for (i = 0; i < FONT_SIZE_INDEX; i++)
+  for (int i = 0; i < FONT_SIZE_INDEX; i++)
     {
       enum font_property_index idx = font_props_for_sorting[i];
       Lisp_Object val1 = AREF (font1, idx), val2 = AREF (font2, idx);
@@ -2069,9 +2067,7 @@ get_lface_attributes (struct window *w,
 				  face_name, NAMED_MERGE_POINT_REMAP,
 				  &named_merge_points))
 	{
-	  int i;
-
-	  for (i = 1; i < LFACE_VECTOR_SIZE; ++i)
+	  for (int i = 1; i < LFACE_VECTOR_SIZE; ++i)
 	    attrs[i] = Qunspecified;
 
 	  return merge_face_ref (w, f, XCDR (face_remapping), attrs,
@@ -2091,15 +2087,12 @@ get_lface_attributes (struct window *w,
 static bool
 lface_fully_specified_p (Lisp_Object attrs[LFACE_VECTOR_SIZE])
 {
-  int i;
-
-  for (i = 1; i < LFACE_VECTOR_SIZE; ++i)
+  for (int i = 1; i < LFACE_VECTOR_SIZE; ++i)
     if (i != LFACE_FONT_INDEX && i != LFACE_INHERIT_INDEX
-        && i != LFACE_DISTANT_FOREGROUND_INDEX)
-      if ((UNSPECIFIEDP (attrs[i]) || IGNORE_DEFFACE_P (attrs[i])))
-	break;
-
-  return i == LFACE_VECTOR_SIZE;
+        && i != LFACE_DISTANT_FOREGROUND_INDEX
+	&& (UNSPECIFIEDP (attrs[i]) || IGNORE_DEFFACE_P (attrs[i])))
+      return false;
+  return true;
 }
 
 #ifdef HAVE_WINDOW_SYSTEM
@@ -2220,7 +2213,6 @@ merge_face_vectors (struct window *w,
 		    struct frame *f, const Lisp_Object *from, Lisp_Object *to,
                     struct named_merge_point *named_merge_points)
 {
-  int i;
   Lisp_Object font = Qnil;
 
   /* If FROM inherits from some other faces, merge their attributes into
@@ -2243,7 +2235,7 @@ merge_face_vectors (struct window *w,
       to[LFACE_FONT_INDEX] = font;
     }
 
-  for (i = 1; i < LFACE_VECTOR_SIZE; ++i)
+  for (int i = 1; i < LFACE_VECTOR_SIZE; ++i)
     if (!UNSPECIFIEDP (from[i]))
       {
 	if (i == LFACE_HEIGHT_INDEX && !FIXNUMP (from[i]))
@@ -2364,8 +2356,7 @@ merge_named_face (struct window *w,
       if (ok && !EQ (face_name, Qdefault))
 	{
 	  struct face *deflt = FACE_FROM_ID (f, DEFAULT_FACE_ID);
-	  int i;
-	  for (i = 1; i < LFACE_VECTOR_SIZE; i++)
+	  for (int i = 1; i < LFACE_VECTOR_SIZE; i++)
 	    if (EQ (from[i], Qreset))
 	      from[i] = deflt->lface[i];
 	}
@@ -2628,10 +2619,8 @@ merge_face_ref (struct window *w,
 		    return true;
 
 		  Lisp_Object scratch_attrs[LFACE_VECTOR_SIZE];
-		  int i;
-
 		  scratch_attrs[0] = Qface;
-		  for (i = 1; i < LFACE_VECTOR_SIZE; i++)
+		  for (int i = 1; i < LFACE_VECTOR_SIZE; i++)
 		    scratch_attrs[i] = Qunspecified;
 		  if (!merge_face_ref (w, f, parent_face, scratch_attrs,
 				       err_msgs, named_merge_points, 0))
@@ -2884,7 +2873,6 @@ DEFUN ("internal-make-lisp-face", Finternal_make_lisp_face,
 {
   Lisp_Object global_lface, lface;
   struct frame *f;
-  int i;
 
   CHECK_SYMBOL (face);
   global_lface = lface_from_face_name (NULL, face, false);
@@ -2920,7 +2908,7 @@ DEFUN ("internal-make-lisp-face", Finternal_make_lisp_face,
       Fputhash (face, Fcons (face_id, global_lface), Vface_new_frame_defaults);
     }
   else if (f == NULL)
-    for (i = 1; i < LFACE_VECTOR_SIZE; ++i)
+    for (int i = 1; i < LFACE_VECTOR_SIZE; ++i)
       ASET (global_lface, i, Qunspecified);
 
   /* Add a frame-local definition.  */
@@ -2933,7 +2921,7 @@ DEFUN ("internal-make-lisp-face", Finternal_make_lisp_face,
           Fputhash (face, lface, f->face_hash_table);
 	}
       else
-	for (i = 1; i < LFACE_VECTOR_SIZE; ++i)
+	for (int i = 1; i < LFACE_VECTOR_SIZE; ++i)
 	  ASET (lface, i, Qunspecified);
     }
   else
@@ -4152,7 +4140,6 @@ DEFUN ("internal-merge-in-global-face", Finternal_merge_in_global_face,
 Default face attributes override any local face attributes.  */)
   (Lisp_Object face, Lisp_Object frame)
 {
-  int i;
   Lisp_Object global_lface, local_lface, *gvec, *lvec;
   struct frame *f = XFRAME (frame);
 
@@ -4169,7 +4156,7 @@ DEFUN ("internal-merge-in-global-face", Finternal_merge_in_global_face,
      "global before local" priority.  */
   lvec = XVECTOR (local_lface)->contents;
   gvec = XVECTOR (global_lface)->contents;
-  for (i = 1; i < LFACE_VECTOR_SIZE; ++i)
+  for (int i = 1; i < LFACE_VECTOR_SIZE; ++i)
     if (IGNORE_DEFFACE_P (gvec[i]))
       ASET (local_lface, i, Qunspecified);
     else if (! UNSPECIFIEDP (gvec[i]))
@@ -4190,6 +4177,11 @@ DEFUN ("internal-merge-in-global-face", Finternal_merge_in_global_face,
 	     the previously-cached vector.  */
 	  memcpy (attrs, oldface->lface, sizeof attrs);
 
+	  /* Make explicit any attributes whose value is 'reset'.  */
+	  for (int i = 1; i < LFACE_VECTOR_SIZE; i++)
+	    if (EQ (lvec[i], Qreset))
+	      lvec[i] = attrs[i];
+
 	  merge_face_vectors (NULL, f, lvec, attrs, 0);
 	  vcopy (local_lface, 0, attrs, LFACE_VECTOR_SIZE);
 	  newface = realize_face (c, lvec, DEFAULT_FACE_ID);
@@ -4328,10 +4320,9 @@ face_attr_equal_p (Lisp_Object v1, Lisp_Object v2)
 static bool
 lface_equal_p (Lisp_Object *v1, Lisp_Object *v2)
 {
-  int i;
   bool equal_p = true;
 
-  for (i = 1; i < LFACE_VECTOR_SIZE && equal_p; ++i)
+  for (int i = 1; i < LFACE_VECTOR_SIZE && equal_p; ++i)
     equal_p = face_attr_equal_p (v1[i], v2[i]);
 
   return equal_p;
@@ -4374,13 +4365,11 @@ DEFUN ("internal-lisp-face-empty-p", Finternal_lisp_face_empty_p,
 {
   struct frame *f = EQ (frame, Qt) ? NULL : decode_live_frame (frame);
   Lisp_Object lface = lface_from_face_name (f, face, true);
-  int i;
 
-  for (i = 1; i < LFACE_VECTOR_SIZE; ++i)
+  for (int i = 1; i < LFACE_VECTOR_SIZE; ++i)
     if (!UNSPECIFIEDP (AREF (lface, i)))
-      break;
-
-  return i == LFACE_VECTOR_SIZE ? Qt : Qnil;
+      return Qnil;
+  return Qt;
 }
 
 DEFUN ("frame--face-hash-table", Fframe_face_hash_table, Sframe_face_hash_table,
@@ -4657,8 +4646,7 @@ clear_face_gcs (struct face_cache *c)
 {
   if (c && FRAME_WINDOW_P (c->f))
     {
-      int i;
-      for (i = BASIC_FACE_ID_SENTINEL; i < c->used; ++i)
+      for (int i = BASIC_FACE_ID_SENTINEL; i < c->used; ++i)
 	{
 	  struct face *face = c->faces_by_id[i];
 	  if (face && face->gc)
@@ -4686,7 +4674,7 @@ free_realized_faces (struct face_cache *c)
 {
   if (c && c->used)
     {
-      int i, size;
+      int size;
       struct frame *f = c->f;
 
       /* We must block input here because we can't process X events
@@ -4694,7 +4682,7 @@ free_realized_faces (struct face_cache *c)
 	 current matrix still references freed faces.  */
       block_input ();
 
-      for (i = 0; i < c->used; ++i)
+      for (int i = 0; i < c->used; ++i)
 	{
 	  free_realized_face (f, c->faces_by_id[i]);
 	  c->faces_by_id[i] = NULL;
@@ -4797,10 +4785,13 @@ cache_face (struct face_cache *c, struct face *face, uintptr_t hash)
 
   /* Find a free slot in C->faces_by_id and use the index of the free
      slot as FACE->id.  */
+  face->id = c->used;
   for (i = 0; i < c->used; ++i)
     if (c->faces_by_id[i] == NULL)
-      break;
-  face->id = i;
+      {
+	face->id = i;
+	break;
+      }
 
 #ifdef GLYPH_DEBUG
   /* Check that FACE got a unique id.  */
@@ -4818,7 +4809,7 @@ cache_face (struct face_cache *c, struct face *face, uintptr_t hash)
 #endif /* GLYPH_DEBUG */
 
   /* Maybe enlarge C->faces_by_id.  */
-  if (i == c->used)
+  if (face->id == c->used)
     {
       if (c->used == c->size)
 	c->faces_by_id = xpalloc (c->faces_by_id, &c->size, 1, MAX_FACE_ID,
@@ -4826,7 +4817,7 @@ cache_face (struct face_cache *c, struct face *face, uintptr_t hash)
       c->used++;
     }
 
-  c->faces_by_id[i] = face;
+  c->faces_by_id[face->id] = face;
 }
 
 
@@ -4958,8 +4949,7 @@ lookup_named_face (struct window *w, struct frame *f,
   memcpy (attrs, default_face->lface, sizeof attrs);
 
   /* Make explicit any attributes whose value is 'reset'.  */
-  int i;
-  for (i = 1; i < LFACE_VECTOR_SIZE; i++)
+  for (int i = 1; i < LFACE_VECTOR_SIZE; i++)
     if (EQ (symbol_attrs[i], Qreset))
       symbol_attrs[i] = attrs[i];
 
@@ -5135,8 +5125,7 @@ lookup_derived_face (struct window *w,
   memcpy (attrs, default_face->lface, sizeof attrs);
 
   /* Make explicit any attributes whose value is 'reset'.  */
-  int i;
-  for (i = 1; i < LFACE_VECTOR_SIZE; i++)
+  for (int i = 1; i < LFACE_VECTOR_SIZE; i++)
     if (EQ (symbol_attrs[i], Qreset))
       symbol_attrs[i] = attrs[i];
 
@@ -5190,8 +5179,7 @@ gui_supports_face_attributes_p (struct frame *f,
   Lisp_Object lattrs[LFACE_VECTOR_SIZE];
 
   /* Make explicit any attributes whose value is 'reset'.  */
-  int i;
-  for (i = 1; i < LFACE_VECTOR_SIZE; i++)
+  for (int i = 1; i < LFACE_VECTOR_SIZE; i++)
     {
       if (EQ (attrs[i], Qreset))
 	lattrs[i] = def_attrs[i];
@@ -5245,7 +5233,6 @@ gui_supports_face_attributes_p (struct frame *f,
       int face_id;
       struct face *face;
       Lisp_Object merged_attrs[LFACE_VECTOR_SIZE];
-      int i;
 
       memcpy (merged_attrs, def_attrs, sizeof merged_attrs);
 
@@ -5262,7 +5249,7 @@ gui_supports_face_attributes_p (struct frame *f,
       if (face->font == def_face->font
 	  || ! face->font)
 	return false;
-      for (i = FONT_TYPE_INDEX; i <= FONT_SIZE_INDEX; i++)
+      for (int i = FONT_TYPE_INDEX; i <= FONT_SIZE_INDEX; i++)
 	if (! EQ (face->font->props[i], def_face->font->props[i]))
 	  {
 	    Lisp_Object s1, s2;
@@ -5499,7 +5486,6 @@ Point (2) implies that a `:weight black' attribute will be satisfied by
   (Lisp_Object attributes, Lisp_Object display)
 {
   bool supports = false;
-  int i;
   Lisp_Object frame;
   struct frame *f;
   struct face *def_face;
@@ -5531,7 +5517,7 @@ Point (2) implies that a `:weight black' attribute will be satisfied by
   CHECK_LIVE_FRAME (frame);
   f = XFRAME (frame);
 
-  for (i = 0; i < LFACE_VECTOR_SIZE; i++)
+  for (int i = 0; i < LFACE_VECTOR_SIZE; i++)
     attrs[i] = Qunspecified;
   merge_face_ref (NULL, f, attributes, attrs, true, NULL, 0);
 
@@ -5572,12 +5558,11 @@ DEFUN ("internal-set-font-selection-order",
   (Lisp_Object order)
 {
   Lisp_Object list;
-  int i;
+  int i = 0;
   int indices[ARRAYELTS (font_sort_order)];
 
   CHECK_LIST (order);
   memset (indices, 0, sizeof indices);
-  i = 0;
 
   for (list = order;
        CONSP (list) && i < ARRAYELTS (indices);
@@ -5911,8 +5896,7 @@ realize_named_face (struct frame *f, Lisp_Object symbol, int id)
 
   /* Handle the 'reset' pseudo-value of any attribute by replacing it
      with the corresponding value of the default face.  */
-  int i;
-  for (i = 1; i < LFACE_VECTOR_SIZE; i++)
+  for (int i = 1; i < LFACE_VECTOR_SIZE; i++)
     if (EQ (symbol_attrs[i], Qreset))
       symbol_attrs[i] = attrs[i];
   /* Merge SYMBOL's face with the default face.  */
@@ -6531,7 +6515,7 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos,
   struct frame *f = XFRAME (w->frame);
   Lisp_Object attrs[LFACE_VECTOR_SIZE];
   Lisp_Object prop, position;
-  ptrdiff_t i, noverlays;
+  ptrdiff_t noverlays;
   Lisp_Object *overlay_vec;
   ptrdiff_t endpos;
   Lisp_Object propname = mouse ? Qmouse_face : Qface;
@@ -6610,7 +6594,8 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos,
      from the overlays, if any.  */
   if (mouse)
     {
-      for (prop = Qnil, i = noverlays - 1; i >= 0 && NILP (prop); --i)
+      prop = Qnil;
+      for (ptrdiff_t i = noverlays - 1; i >= 0 && NILP (prop); --i)
 	{
 	  Lisp_Object oend;
 	  ptrdiff_t oendpos;
@@ -6633,7 +6618,7 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos,
     }
   else
     {
-      for (i = 0; i < noverlays; i++)
+      for (ptrdiff_t i = 0; i < noverlays; i++)
 	{
 	  Lisp_Object oend;
 	  ptrdiff_t oendpos;
@@ -6857,11 +6842,10 @@ merge_faces (struct window *w, Lisp_Object face_name, int face_id,
 	{
 	  struct face *deflt = FACE_FROM_ID (f, DEFAULT_FACE_ID);
 	  Lisp_Object lface_attrs[LFACE_VECTOR_SIZE];
-	  int i;
 
 	  memcpy (lface_attrs, face->lface, LFACE_VECTOR_SIZE);
 	  /* Make explicit any attributes whose value is 'reset'.  */
-	  for (i = 1; i < LFACE_VECTOR_SIZE; i++)
+	  for (int i = 1; i < LFACE_VECTOR_SIZE; i++)
 	    if (EQ (lface_attrs[i], Qreset))
 	      lface_attrs[i] = deflt->lface[i];
 	  merge_face_vectors (w, f, lface_attrs, attrs, 0);
@@ -6965,10 +6949,8 @@ DEFUN ("dump-face", Fdump_face, Sdump_face, 0, 1, 0, doc: /* */)
 {
   if (NILP (n))
     {
-      int i;
-
       fputs ("font selection order: ", stderr);
-      for (i = 0; i < ARRAYELTS (font_sort_order); ++i)
+      for (int i = 0; i < ARRAYELTS (font_sort_order); ++i)
 	fprintf (stderr, "%d ", font_sort_order[i]);
       putc ('\n', stderr);
 
@@ -6976,7 +6958,7 @@ DEFUN ("dump-face", Fdump_face, Sdump_face, 0, 1, 0, doc: /* */)
       debug_print (Vface_alternative_font_family_alist);
       putc ('\n', stderr);
 
-      for (i = 0; i < FRAME_FACE_CACHE (SELECTED_FRAME ())->used; ++i)
+      for (int i = 0; i < FRAME_FACE_CACHE (SELECTED_FRAME ())->used; ++i)
 	Fdump_face (make_fixnum (i));
     }
   else
diff --git a/src/xterm.c b/src/xterm.c
index dc7e3283a5c..d70e78b6b34 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -10633,10 +10633,6 @@ x_scroll_run (struct window *w, struct run *run)
 static void
 x_frame_highlight (struct frame *f)
 {
-  struct x_display_info *dpyinfo;
-
-  dpyinfo = FRAME_DISPLAY_INFO (f);
-
   /* We used to only do this if Vx_no_window_manager was non-nil, but
      the ICCCM (section 4.1.6) says that the window's border pixmap
      and border pixel are window attributes which are "private to the
@@ -10646,10 +10642,10 @@ x_frame_highlight (struct frame *f)
      the window-manager in use, tho something more is at play since I've been
      using that same window-manager binary for ever.  Let's not crash just
      because of this (bug#9310).  */
-  x_ignore_errors_for_next_request (dpyinfo);
+  x_catch_errors (FRAME_X_DISPLAY (f));
   XSetWindowBorder (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
 		    f->output_data.x->border_pixel);
-  x_stop_ignoring_errors (dpyinfo);
+  x_uncatch_errors ();
   unblock_input ();
   gui_update_cursor (f, true);
   x_set_frame_alpha (f);
@@ -10658,23 +10654,17 @@ x_frame_highlight (struct frame *f)
 static void
 x_frame_unhighlight (struct frame *f)
 {
-  struct x_display_info *dpyinfo;
-
-  dpyinfo = FRAME_DISPLAY_INFO (f);
-
   /* We used to only do this if Vx_no_window_manager was non-nil, but
      the ICCCM (section 4.1.6) says that the window's border pixmap
      and border pixel are window attributes which are "private to the
      client", so we can always change it to whatever we want.  */
-
   block_input ();
   /* Same as above for XSetWindowBorder (bug#9310).  */
-  x_ignore_errors_for_next_request (dpyinfo);
+  x_catch_errors (FRAME_X_DISPLAY (f));
   XSetWindowBorderPixmap (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
 			  f->output_data.x->border_tile);
-  x_stop_ignoring_errors (dpyinfo);
+  x_uncatch_errors ();
   unblock_input ();
-
   gui_update_cursor (f, true);
   x_set_frame_alpha (f);
 }
-- 
2.36.1


[-- Attachment #3: Type: text/plain, Size: 14251 bytes --]




In Commercial Emacs 0.3.1snapshot 98cf0cf in dev (upstream 29.0.50, x86_64-pc-linux-gnu) built on dick
Repository revision: 98cf0cfd887f1cfe5567d0c048f88a70d939e8f9
Repository branch: dev
Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
System Description: Ubuntu 20.04.4 LTS

Configured using:
 'configure --prefix=/home/dick/.local --with-tree-sitter'
Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
TREE_SITTER LCMS2 LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG
RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM
XINPUT2 XPM GTK3 ZLIB
Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Magit Log

Minor modes in effect:
  global-git-commit-mode: t
  shell-dirtrack-mode: t
  projectile-mode: t
  flx-ido-mode: t
  override-global-mode: t
  global-hl-line-mode: t
  hl-line-mode: t
  winner-mode: t
  tooltip-mode: t
  show-paren-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/dick/gomacro-mode/gomacro-mode hides /home/dick/.emacs.d/elpa/gomacro-mode-20200326.1103/gomacro-mode
/home/dick/.emacs.d/elpa/go-rename-20190805.2101/go-rename hides /home/dick/.emacs.d/elpa/go-mode-1.6.0/go-rename
/home/dick/.emacs.d/elpa/go-guru-20181012.330/go-guru hides /home/dick/.emacs.d/elpa/go-mode-1.6.0/go-guru
/home/dick/org-gcal.el/org-gcal hides /home/dick/.emacs.d/elpa/org-gcal-0.3/org-gcal
/home/dick/.emacs.d/elpa/request-deferred-0.2.0/request-deferred hides /home/dick/.emacs.d/elpa/request-0.3.3/request-deferred
/home/dick/.emacs.d/elpa/chess-2.0.5/_pkg hides /home/dick/.local/share/emacs/site-lisp/_pkg
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-pos hides /home/dick/.local/share/emacs/site-lisp/chess-pos
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-module hides /home/dick/.local/share/emacs/site-lisp/chess-module
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-ucb hides /home/dick/.local/share/emacs/site-lisp/chess-ucb
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-scid hides /home/dick/.local/share/emacs/site-lisp/chess-scid
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-puzzle hides /home/dick/.local/share/emacs/site-lisp/chess-puzzle
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-irc hides /home/dick/.local/share/emacs/site-lisp/chess-irc
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-network hides /home/dick/.local/share/emacs/site-lisp/chess-network
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-autosave hides /home/dick/.local/share/emacs/site-lisp/chess-autosave
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-engine hides /home/dick/.local/share/emacs/site-lisp/chess-engine
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-tutorial hides /home/dick/.local/share/emacs/site-lisp/chess-tutorial
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-german hides /home/dick/.local/share/emacs/site-lisp/chess-german
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-file hides /home/dick/.local/share/emacs/site-lisp/chess-file
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-random hides /home/dick/.local/share/emacs/site-lisp/chess-random
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-stockfish hides /home/dick/.local/share/emacs/site-lisp/chess-stockfish
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-pgn hides /home/dick/.local/share/emacs/site-lisp/chess-pgn
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-kibitz hides /home/dick/.local/share/emacs/site-lisp/chess-kibitz
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-eco hides /home/dick/.local/share/emacs/site-lisp/chess-eco
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-display hides /home/dick/.local/share/emacs/site-lisp/chess-display
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-var hides /home/dick/.local/share/emacs/site-lisp/chess-var
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-test hides /home/dick/.local/share/emacs/site-lisp/chess-test
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-ply hides /home/dick/.local/share/emacs/site-lisp/chess-ply
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-message hides /home/dick/.local/share/emacs/site-lisp/chess-message
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-ics1 hides /home/dick/.local/share/emacs/site-lisp/chess-ics1
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-phalanx hides /home/dick/.local/share/emacs/site-lisp/chess-phalanx
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-game hides /home/dick/.local/share/emacs/site-lisp/chess-game
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-log hides /home/dick/.local/share/emacs/site-lisp/chess-log
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-plain hides /home/dick/.local/share/emacs/site-lisp/chess-plain
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-perft hides /home/dick/.local/share/emacs/site-lisp/chess-perft
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-glaurung hides /home/dick/.local/share/emacs/site-lisp/chess-glaurung
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-ai hides /home/dick/.local/share/emacs/site-lisp/chess-ai
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-fruit hides /home/dick/.local/share/emacs/site-lisp/chess-fruit
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-uci hides /home/dick/.local/share/emacs/site-lisp/chess-uci
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-epd hides /home/dick/.local/share/emacs/site-lisp/chess-epd
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-database hides /home/dick/.local/share/emacs/site-lisp/chess-database
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-link hides /home/dick/.local/share/emacs/site-lisp/chess-link
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-transport hides /home/dick/.local/share/emacs/site-lisp/chess-transport
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-none hides /home/dick/.local/share/emacs/site-lisp/chess-none
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-polyglot hides /home/dick/.local/share/emacs/site-lisp/chess-polyglot
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-crafty hides /home/dick/.local/share/emacs/site-lisp/chess-crafty
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-chat hides /home/dick/.local/share/emacs/site-lisp/chess-chat
/home/dick/.emacs.d/elpa/chess-2.0.5/chess hides /home/dick/.local/share/emacs/site-lisp/chess
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-images hides /home/dick/.local/share/emacs/site-lisp/chess-images
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-gnuchess hides /home/dick/.local/share/emacs/site-lisp/chess-gnuchess
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-fen hides /home/dick/.local/share/emacs/site-lisp/chess-fen
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-ics hides /home/dick/.local/share/emacs/site-lisp/chess-ics
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-ics2 hides /home/dick/.local/share/emacs/site-lisp/chess-ics2
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-common hides /home/dick/.local/share/emacs/site-lisp/chess-common
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-input hides /home/dick/.local/share/emacs/site-lisp/chess-input
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-announce hides /home/dick/.local/share/emacs/site-lisp/chess-announce
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-clock hides /home/dick/.local/share/emacs/site-lisp/chess-clock
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-sound hides /home/dick/.local/share/emacs/site-lisp/chess-sound
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-sjeng hides /home/dick/.local/share/emacs/site-lisp/chess-sjeng
/home/dick/.emacs.d/elpa/chess-2.0.5/chess-algebraic hides /home/dick/.local/share/emacs/site-lisp/chess-algebraic
/home/dick/.emacs.d/elpa/transient-0.3.7snapshot/transient hides /home/dick/.local/share/emacs/0.3.1/lisp/transient

Features:
(shadow emacsbug goto-addr shortdoc ivy delsel colir ivy-overlay ffap
pulse dumb-jump bbdb-message footnote gnus-html gravatar dns sh-script
executable org-element avl-tree ol-eww eww xdg ol-rmail ol-mhe ol-irc
ol-info ol-gnus nnselect ol-docview doc-view image-mode exif ol-bibtex
ol-bbdb ol-w3m ol-doi org-link-doi org-tempo tempo org org-macro
org-footnote org-pcomplete org-list org-faces org-entities org-version
ob-R ob-emacs-lisp ob-ein ein-cell ein-shared-output ein-output-area
ein-kernel ein-ipdb ein-query ein-events ein-websocket websocket bindat
ein-node ewoc ein-log ein-classes ein-core ein ein-utils deferred ob
ob-tangle org-src ob-ref ob-lob ob-table ob-exp ob-comint ob-core
ob-eval org-table oc-basic bibtex ol org-keys oc org-compat org-macs
org-loaddefs cal-menu calendar cal-loaddefs help-fns radix-tree cl-print
debug backtrace vc bug-reference cc-mode cc-fonts cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs tramp-archive
tramp-gvfs tramp-cache zeroconf jka-compr nndoc display-line-numbers
debbugs-gnu debbugs-compat debbugs soap-client rng-xsd rng-dt rng-util
xsd-regexp poly-rst rst polymode poly-lock polymode-base polymode-weave
polymode-export polymode-compat polymode-methods polymode-core
polymode-classes eieio-custom eieio-base vc-git vc-dispatcher ag vc-svn
find-dired misearch multi-isearch elpaso elpaso-admin elpaso-milky
elpaso-defs magit-extras mule-util face-remap magit-patch-changelog
magit-patch magit-submodule magit-obsolete magit-blame magit-stash
magit-reflog magit-bisect magit-push magit-pull magit-fetch magit-clone
magit-remote magit-commit magit-sequence magit-notes magit-worktree
magit-tag magit-merge magit-branch magit-reset magit-files magit-refs
magit-status magit magit-repos magit-apply magit-wip magit-log
which-func imenu magit-diff smerge-mode diff diff-mode git-commit
log-edit pcvs-util add-log magit-core magit-margin magit-transient
magit-process with-editor server magit-mode transient shr-color
url-queue qp mm-archive sort smiley mail-extr textsec uni-scripts
idna-mapping ucs-normalize uni-confusable textsec-check gnus-async
gnus-ml gnus-notifications gnus-fun notifications gnus-kill gnus-dup
disp-table utf-7 blamer a tramp tramp-loaddefs trampver
tramp-integration cus-start files-x tramp-compat shell pcomplete ls-lisp
url-cache benchmark nnrss nnfolder nndiscourse rbenv nnhackernews
nntwitter nntwitter-api bbdb-gnus gnus-demon nntp nnmairix nnml nnreddit
gnus-topic url-http url-auth url-gw network-stream nsm request
virtualenvwrapper gud s json-rpc python gnus-score score-mode gnus-bcklg
gnus-srvr gnus-cite anaphora bbdb-mua bbdb-com bbdb bbdb-site timezone
gnus-delay gnus-draft gnus-cache gnus-agent gnus-msg gnus-art mm-uu
mml2015 mm-view mml-smime smime gnutls dig gnus-sum shr pixel-fill
kinsoku url-file url-dired svg dom nndraft nnmh gnus-group mm-url
gnus-undo use-package use-package-delight use-package-diminish
gnus-start gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7
netrc nnoo parse-time iso8601 gnus-spec gnus-int gnus-range message
sendmail yank-media puny dired-x dired dired-loaddefs rfc822 mml mml-sec
epa epg rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse
rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader
gnus-win paredit-ext paredit inf-ruby ruby-mode smie company pcase
haskell-interactive-mode haskell-presentation-mode haskell-process
haskell-session haskell-compile haskell-mode haskell-cabal haskell-utils
haskell-font-lock haskell-indentation haskell-string
haskell-sort-imports haskell-lexeme haskell-align-imports
haskell-complete-module haskell-ghc-support noutline outline
flymake-proc flymake warnings etags fileloop generator dabbrev
haskell-customize hydra lv use-package-ensure solarized-theme
solarized-definitions projectile lisp-mnt ibuf-ext ibuffer
ibuffer-loaddefs thingatpt magit-autorevert autorevert filenotify
magit-git magit-base magit-section format-spec crm dash rx compat-27
compat-26 compat grep compile comint ansi-color gnus nnheader range
mail-utils mm-util mail-prsvr gnus-util text-property-search time-date
flx-ido flx google-translate-default-ui google-translate-core-ui
facemenu color ido google-translate-core google-translate-tk
google-translate-backend use-package-bind-key bind-key auto-complete
easy-mmode advice edmacro kmacro popup cus-edit pp cus-load wid-edit
emms-player-mplayer emms-player-simple emms emms-compat cl-extra
help-mode xref project use-package-core derived hl-line winner ring
debbugs-autoloads eglot-autoloads elpaso-disc-autoloads elpaso-autoloads
find-func finder-inf go-mode-autoloads json-reformat-autoloads
json-snatcher-autoloads projectile-autoloads sml-mode-autoloads
epl-autoloads tornado-template-mode-autoloads typescript-mode-autoloads
request-autoloads info package browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie generate-lisp-file
url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map
byte-opt gv bytecomp byte-compile cconv cldefs url-vars cl-loaddefs
cl-lib rmc iso-transl tooltip eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tree-sitter tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
faces cus-face macroexp files window text-properties overlay sha1 md5
base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process
emacs)

Memory information:
((conses 16 2425183 261237)
 (symbols 48 57246 64)
 (strings 32 380879 102783)
 (string-bytes 1 14283720)
 (vectors 16 166398)
 (vector-slots 8 4365510 220301)
 (floats 8 4040 4208)
 (intervals 56 126065 5375)
 (buffers 1000 58))

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* bug#56372: 29.0.50; [PATCH] Avoid BadMatch X11 error
  2022-07-03 14:45 bug#56372: 29.0.50; [PATCH] Avoid BadMatch X11 error dick.r.chiang
@ 2022-07-04  0:50 ` Katsumi Yamaoka
  2022-07-04  5:21   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-07-04  1:16 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-07-04  4:50 ` dick
  2 siblings, 1 reply; 14+ messages in thread
From: Katsumi Yamaoka @ 2022-07-04  0:50 UTC (permalink / raw)
  To: dick.r.chiang; +Cc: 56372

On Sun, 03 Jul 2022 10:45:07 -0400, dick.r.chiang@gmail.com wrote:
> With my particular font sizing, I get an X11 BadMatch (invalid parameter
> attributes) error one out of every 10 starts or so.

By the patch, 29.0.50 built on Cygwin got stable.  It crashed
for the BadMatch error whenever I did something.  Thank you.





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#56372: 29.0.50; [PATCH] Avoid BadMatch X11 error
  2022-07-03 14:45 bug#56372: 29.0.50; [PATCH] Avoid BadMatch X11 error dick.r.chiang
  2022-07-04  0:50 ` Katsumi Yamaoka
@ 2022-07-04  1:16 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-07-04  6:05   ` po lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-07-04  4:50 ` dick
  2 siblings, 1 reply; 14+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-07-04  1:16 UTC (permalink / raw)
  To: dick.r.chiang; +Cc: 56372

dick.r.chiang@gmail.com writes:

> With my particular font sizing, I get an X11 BadMatch (invalid parameter
> attributes) error one out of every 10 starts or so.
>
>>From 95911e85c12e91123ebc4448700f67877b4109cc Mon Sep 17 00:00:00 2001
> From: dickmao <dick.r.chiang@gmail.com>
> Date: Sun, 3 Jul 2022 10:34:20 -0400
> Subject: [PATCH] Avoid a BadMatch X11 error
>
> x_uncatch_errors() might do a sync that
> x_ignore_errors_for_next_request() doesn't?  The details are unclear.

Where is the error, and what request is generating it?

The X server reports errors asynchronously, the next time Xlib or Emacs
calls XSync after the erroring request is made.

x_ignore_errors_for_next_request and x_stop_ignoring_errors don't call
XSync (unlike the usual error handling and checking functions) -- they
only make a note of the range of requests made inside them, so the
x_error_handler knows that it should ignore the error.  This is done for
speed, since syncing is slow, especially over connections with high
latency.

So assuming the erroring request is actually XSetWindowBorder, please
see why x_error_handler is actually not ignoring the error.

The useless reformatting of code in xfaces.c, is, as usual for patches
from you, unacceptable.





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#56372: 29.0.50; [PATCH] Avoid BadMatch X11 error
  2022-07-03 14:45 bug#56372: 29.0.50; [PATCH] Avoid BadMatch X11 error dick.r.chiang
  2022-07-04  0:50 ` Katsumi Yamaoka
  2022-07-04  1:16 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-07-04  4:50 ` dick
  2022-07-04 10:10   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2 siblings, 1 reply; 14+ messages in thread
From: dick @ 2022-07-04  4:50 UTC (permalink / raw)
  To: 56372

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: 0001-Avoid-segfault.patch --]
[-- Type: text/x-diff, Size: 1472 bytes --]

From 5d2442a836a5641f8f1c2b4a844fe510a77bd8c5 Mon Sep 17 00:00:00 2001
From: dickmao <dick.r.chiang@gmail.com>
Date: Mon, 4 Jul 2022 00:47:34 -0400
Subject: [PATCH] Avoid segfault

* src/xterm.c (x_connection_closed): Avoid segfault.
---
 src/xterm.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index c5acb450837..464887da975 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -23518,17 +23518,18 @@ x_connection_closed (Display *dpy, const char *error_message, bool ioerror)
 
 	  fprintf (stderr, "X error handlers currently installed:\n");
 
-	  for (failable = dpyinfo->failable_requests;
-	       failable < dpyinfo->next_failable_request;
-	       ++failable)
-	    {
-	      if (failable->end)
-		fprintf (stderr, "Ignoring errors between %lu to %lu\n",
-			 failable->start, failable->end);
-	      else
-		fprintf (stderr, "Ignoring errors from %lu onwards\n",
-			 failable->start);
-	    }
+	  if (dpyinfo)
+	    for (failable = dpyinfo->failable_requests;
+		 failable < dpyinfo->next_failable_request;
+		 ++failable)
+	      {
+		if (failable->end)
+		  fprintf (stderr, "Ignoring errors between %lu to %lu\n",
+			   failable->start, failable->end);
+		else
+		  fprintf (stderr, "Ignoring errors from %lu onwards\n",
+			   failable->start);
+	      }
 
 	  for (stack = x_error_message; stack; stack = stack->prev)
 	    fprintf (stderr, "Trapping errors from %lu\n",
-- 
2.36.1






^ permalink raw reply related	[flat|nested] 14+ messages in thread

* bug#56372: 29.0.50; [PATCH] Avoid BadMatch X11 error
  2022-07-04  0:50 ` Katsumi Yamaoka
@ 2022-07-04  5:21   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-07-04 23:15     ` Katsumi Yamaoka
  0 siblings, 1 reply; 14+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-07-04  5:21 UTC (permalink / raw)
  To: Katsumi Yamaoka; +Cc: 56372, dick.r.chiang

Katsumi Yamaoka <yamaoka@jpl.org> writes:

> By the patch, 29.0.50 built on Cygwin got stable.  It crashed
> for the BadMatch error whenever I did something.  Thank you.

Would you please show the complete error message resulting from the
BadMatch error with a new build from master?

Also, what toolkit are you using?





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#56372: 29.0.50; [PATCH] Avoid BadMatch X11 error
  2022-07-04  1:16 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-07-04  6:05   ` po lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-07-05  0:21     ` dick
  0 siblings, 1 reply; 14+ messages in thread
From: po lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-07-04  6:05 UTC (permalink / raw)
  To: dick.r.chiang; +Cc: 56372

Po Lu <luangruo@yahoo.com> writes:

> x_ignore_errors_for_next_request and x_stop_ignoring_errors don't call
> XSync (unlike the usual error handling and checking functions) -- they
> only make a note of the range of requests made inside them, so the
> x_error_handler knows that it should ignore the error.  This is done for
> speed, since syncing is slow, especially over connections with high
> latency.

I reproduced the bug with a GTK build.  It should be fixed now, please
test.





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#56372: 29.0.50; [PATCH] Avoid BadMatch X11 error
  2022-07-04  4:50 ` dick
@ 2022-07-04 10:10   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-07-04 10:19     ` Lars Ingebrigtsen
  2022-07-04 12:12     ` dick
  0 siblings, 2 replies; 14+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-07-04 10:10 UTC (permalink / raw)
  To: dick; +Cc: 56372

dick <dick.r.chiang@gmail.com> writes:

>>From 5d2442a836a5641f8f1c2b4a844fe510a77bd8c5 Mon Sep 17 00:00:00 2001
> From: dickmao <dick.r.chiang@gmail.com>
> Date: Mon, 4 Jul 2022 00:47:34 -0400
> Subject: [PATCH] Avoid segfault
>
> * src/xterm.c (x_connection_closed): Avoid segfault.
> ---
>  src/xterm.c | 23 ++++++++++++-----------
>  1 file changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/src/xterm.c b/src/xterm.c
> index c5acb450837..464887da975 100644
> --- a/src/xterm.c
> +++ b/src/xterm.c
> @@ -23518,17 +23518,18 @@ x_connection_closed (Display *dpy, const char *error_message, bool ioerror)
>  
>  	  fprintf (stderr, "X error handlers currently installed:\n");
>  
> -	  for (failable = dpyinfo->failable_requests;
> -	       failable < dpyinfo->next_failable_request;
> -	       ++failable)
> -	    {
> -	      if (failable->end)
> -		fprintf (stderr, "Ignoring errors between %lu to %lu\n",
> -			 failable->start, failable->end);
> -	      else
> -		fprintf (stderr, "Ignoring errors from %lu onwards\n",
> -			 failable->start);
> -	    }
> +	  if (dpyinfo)
> +	    for (failable = dpyinfo->failable_requests;
> +		 failable < dpyinfo->next_failable_request;
> +		 ++failable)
> +	      {
> +		if (failable->end)
> +		  fprintf (stderr, "Ignoring errors between %lu to %lu\n",
> +			   failable->start, failable->end);
> +		else
> +		  fprintf (stderr, "Ignoring errors from %lu onwards\n",
> +			   failable->start);
> +	      }
>  
>  	  for (stack = x_error_message; stack; stack = stack->prev)
>  	    fprintf (stderr, "Trapping errors from %lu\n",

That piece of code is already inside "if (dpyinfo)" -- in fact, your
patch misses a use-after-free, which has already been fixed on master.





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#56372: 29.0.50; [PATCH] Avoid BadMatch X11 error
  2022-07-04 10:10   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-07-04 10:19     ` Lars Ingebrigtsen
  2022-07-04 10:58       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-07-04 12:12     ` dick
  1 sibling, 1 reply; 14+ messages in thread
From: Lars Ingebrigtsen @ 2022-07-04 10:19 UTC (permalink / raw)
  To: dick; +Cc: Po Lu, 56372

Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs@gnu.org> writes:

> That piece of code is already inside "if (dpyinfo)"

Indeed.  And aren't we testing for dpyinfo twice already in that code?

Unless I'm misreading, it's:

  /* If DPYINFO is null, this means we didn't open the display in the
     first place, so don't try to close it.  */
  if (dpyinfo)
    {
... no code here that sets dpyinfo ...
[...]
      if (dpyinfo->terminal == terminal_list
	  && !terminal_list->next_terminal)
	{
	  fprintf (stderr, "%s\n", error_msg);

	  if (!ioerror && dpyinfo)
	    {

That && dpyinfo seems redundant?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#56372: 29.0.50; [PATCH] Avoid BadMatch X11 error
  2022-07-04 10:19     ` Lars Ingebrigtsen
@ 2022-07-04 10:58       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 14+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-07-04 10:58 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 56372, dick

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text
> editors" <bug-gnu-emacs@gnu.org> writes:
>
>> That piece of code is already inside "if (dpyinfo)"
>
> Indeed.  And aren't we testing for dpyinfo twice already in that code?
>
> Unless I'm misreading, it's:
>
>   /* If DPYINFO is null, this means we didn't open the display in the
>      first place, so don't try to close it.  */
>   if (dpyinfo)
>     {
> ... no code here that sets dpyinfo ...
> [...]
>       if (dpyinfo->terminal == terminal_list
> 	  && !terminal_list->next_terminal)
> 	{
> 	  fprintf (stderr, "%s\n", error_msg);
>
> 	  if (!ioerror && dpyinfo)
> 	    {
>
> That && dpyinfo seems redundant?

Yes, sorry.  That's left over from another piece of code.





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#56372: 29.0.50; [PATCH] Avoid BadMatch X11 error
  2022-07-04 10:10   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-07-04 10:19     ` Lars Ingebrigtsen
@ 2022-07-04 12:12     ` dick
  2022-07-04 12:34       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 14+ messages in thread
From: dick @ 2022-07-04 12:12 UTC (permalink / raw)
  To: 56372; +Cc: luangruo, larsi

BrfGEtSakote> That piece of code is already inside "if (dpyinfo)" -- in
BrfGEtSakote> fact, your patch misses a use-after-free, which has
BrfGEtSakote> already been fixed on master.

Sheesh, how about "Thanks, I fixed it in bd034b3," as opposed to
implying there was never a bug, and that my patch fails to
address an unrelated issue.

I get it though.  My own social and technical failings in the private
sector have also led me to emacs, a halfway house for greybeards exiled
from the labor market.





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#56372: 29.0.50; [PATCH] Avoid BadMatch X11 error
  2022-07-04 12:12     ` dick
@ 2022-07-04 12:34       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 14+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-07-04 12:34 UTC (permalink / raw)
  To: dick; +Cc: 56372, Lars Ingebrigtsen

dick <dick.r.chiang@gmail.com> writes:

> Sheesh, how about "Thanks, I fixed it in bd034b3," as opposed to
> implying there was never a bug, and that my patch fails to
> address an unrelated issue.

bd034b3 fixes an unrelated issue, which is that the display info
structure is freed with the terminal and shouldn't be accessed after it
is deleted.

> I get it though.  My own social and technical failings in the private
> sector have also led me to emacs, a halfway house for greybeards exiled
> from the labor market.

Making personal attacks will only shun you from that sector further.

So, has the bug you reported been fixed or not? I couldn't reliably
reproduce it on my machine in the first place.





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#56372: 29.0.50; [PATCH] Avoid BadMatch X11 error
  2022-07-04  5:21   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-07-04 23:15     ` Katsumi Yamaoka
  0 siblings, 0 replies; 14+ messages in thread
From: Katsumi Yamaoka @ 2022-07-04 23:15 UTC (permalink / raw)
  To: Po Lu; +Cc: 56372, dick.r.chiang

On Mon, 04 Jul 2022 13:21:46 +0800, Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote:
> Katsumi Yamaoka <yamaoka@jpl.org> writes:

>> By the patch, 29.0.50 built on Cygwin got stable.  It crashed
>> for the BadMatch error whenever I did something.  Thank you.

> Would you please show the complete error message resulting from the
> BadMatch error with a new build from master?

I got not to be able to reproduce the problem thanks to your
recent change in revno c4e93b6. :)  But it at least said "GDK"
error and "Badmatch".

> Also, what toolkit are you using?

gtk3

Anyway thank you very much for fixing this.
Regards,





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#56372: 29.0.50; [PATCH] Avoid BadMatch X11 error
  2022-07-04  6:05   ` po lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-07-05  0:21     ` dick
  2022-07-05  1:38       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 14+ messages in thread
From: dick @ 2022-07-05  0:21 UTC (permalink / raw)
  To: po lu; +Cc: 56372

Yes, it's fixed.  Well done.





^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#56372: 29.0.50; [PATCH] Avoid BadMatch X11 error
  2022-07-05  0:21     ` dick
@ 2022-07-05  1:38       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 14+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-07-05  1:38 UTC (permalink / raw)
  To: dick; +Cc: 56372-done

dick <dick.r.chiang@gmail.com> writes:

> Yes, it's fixed.

Closing.  Thanks for testing.






^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-07-05  1:38 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-03 14:45 bug#56372: 29.0.50; [PATCH] Avoid BadMatch X11 error dick.r.chiang
2022-07-04  0:50 ` Katsumi Yamaoka
2022-07-04  5:21   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-04 23:15     ` Katsumi Yamaoka
2022-07-04  1:16 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-04  6:05   ` po lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-05  0:21     ` dick
2022-07-05  1:38       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-04  4:50 ` dick
2022-07-04 10:10   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-04 10:19     ` Lars Ingebrigtsen
2022-07-04 10:58       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-07-04 12:12     ` dick
2022-07-04 12:34       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors

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).