all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Odd async errors
@ 2007-09-27 21:55 Stefan Monnier
  2007-09-28 19:04 ` Richard Stallman
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2007-09-27 21:55 UTC (permalink / raw)
  To: emacs-devel


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 */

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

* Re: Odd async errors
  2007-09-27 21:55 Odd async errors Stefan Monnier
@ 2007-09-28 19:04 ` Richard Stallman
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Stallman @ 2007-09-28 19:04 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

In those changes, I do not think anything else needs
to be included in the BLOCK_INPUT.

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

end of thread, other threads:[~2007-09-28 19:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-27 21:55 Odd async errors Stefan Monnier
2007-09-28 19:04 ` Richard Stallman

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.