emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Odd async errors


From: Stefan Monnier
Subject: Odd async errors
Date: Thu, 27 Sep 2007 17:55:24 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]