I'm using GHC 6.10.2 with Gtk2Hs from darcs. Very occasionally Yi
gives this error and exits:

The program 'yi' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadAlloc (insufficient resources for operation)'.
  (Details: serial 406 error_code 11 request_code 53 minor_code 0)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)

I've tried to narrow this down to a test case. Run the attached program with:
make
./gcgc --sync
Resize the window or hit a few keys, it seems to error quite quickly.
(Unfortunately, without --sync this test program doesn't seem to
crash.)

I either get an X error message:
gcgc: Fatal IO error 0 (Success) on X server :0.0.
or gcgc: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.0.

Or one of various glibc messages:
*** glibc detected *** Segmentation fault
or *** glibc detected *** ./gcgc: free(): invalid pointer: 0x09495a78 ***
or *** glibc detected *** ./gcgc: double free or corruption (fasttop):
0x0831bff0 ***
or *** glibc detected *** ./gcgc: corrupted double-linked list: 0x08596c58 ***

The GDB trace shows that gtk calls are being run in separate threads.
import Graphics.UI.Gtk
main = do
  unsafeInitGUIForThreadedRTS
  win <- windowNew
  onDestroy win mainQuit
  onExpose win $ \_ -> do
      dw <- widgetGetDrawWindow win
      gcNew dw
      return True
  widgetShowAll win
  mainGUI

Attachment: Makefile
Description: Binary data

Attachment: gcgc.trace
Description: Binary data

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Gtk2hs-devel mailing list
Gtk2hs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtk2hs-devel

Reply via email to