all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Subject: Odd async errors
Date: Thu, 27 Sep 2007 17:55:24 -0400	[thread overview]
Message-ID: <jwvabr7lqz7.fsf-monnier+emacs@gnu.org> (raw)


I "recently" started to get a lot of "async ..." errors from X, which
typically indicate a lack of BLOCK_INPUT somewhere.

After a bit of debugging, I got a backtrace that indicated that there can be
a problem where XFreeGC(face->gc) is called, and before face->gc is set to
NULL, a signal is received which causes a whole bunch of work (including
Gtk-specific something, which is probably why it's "new") which tries to use
this face->gc although it's been freed.

The patch below seems to have fixed those problems, but I'm wondering if
someone could take a look at them and tell me if they're sufficient.
More specifically, should the BLOCK_INPUT also include some of the
surrounding code?


        Stefan


--- xfaces.c	27 sep 2007 14:23:40 -0400	1.365
+++ xfaces.c	27 sep 2007 17:45:57 -0400	
@@ -744,10 +744,9 @@
      struct frame *f;
      GC gc;
 {
-  BLOCK_INPUT;
+  eassert (interrupt_input_blocked);
   IF_DEBUG (xassert (--ngcs >= 0));
   XFreeGC (FRAME_X_DISPLAY (f), gc);
-  UNBLOCK_INPUT;
 }
 
 #endif /* HAVE_X_WINDOWS */
@@ -777,10 +776,8 @@
      struct frame *f;
      GC gc;
 {
-  BLOCK_INPUT;
   IF_DEBUG (xassert (--ngcs >= 0));
   xfree (gc);
-  UNBLOCK_INPUT;
 }
 
 #endif  /* WINDOWSNT */
@@ -807,10 +804,9 @@
      struct frame *f;
      GC gc;
 {
-  BLOCK_INPUT;
+  eassert (interrupt_input_blocked);
   IF_DEBUG (xassert (--ngcs >= 0));
   XFreeGC (FRAME_MAC_DISPLAY (f), gc);
-  UNBLOCK_INPUT;
 }
 
 #endif  /* MAC_OS */
@@ -1257,8 +1253,10 @@
       face->overstrike = needs_overstrike;
       if (face->gc)
 	{
+	  BLOCK_INPUT;
 	  x_free_gc (f, face->gc);
 	  face->gc = 0;
+	  UNBLOCK_INPUT;
 	}
     }
   else
@@ -5256,8 +5254,10 @@
 	    free_face_fontset (f, face);
 	  if (face->gc)
 	    {
+	      BLOCK_INPUT;
 	      x_free_gc (f, face->gc);
 	      face->gc = 0;
+	      UNBLOCK_INPUT;
 	    }
 
 	  free_face_colors (f, face);
@@ -5421,8 +5421,10 @@
 	  struct face *face = c->faces_by_id[i];
 	  if (face && face->gc)
 	    {
+	      BLOCK_INPUT;
 	      x_free_gc (c->f, face->gc);
 	      face->gc = 0;
+	      UNBLOCK_INPUT;
 	    }
 	}
 #endif /* HAVE_WINDOW_SYSTEM */

             reply	other threads:[~2007-09-27 21:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-27 21:55 Stefan Monnier [this message]
2007-09-28 19:04 ` Odd async errors Richard Stallman

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=jwvabr7lqz7.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    /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.