On 2011-01-14, at 10:01 AM, David Bridgham wrote:
Good idea. Turns out that there are already printf's in there, I just need to define debug_free. And doing that . . . it's XFree_Screen().
[ . . . ] release_rc_XColor(0xfd7900) release_rc_XGCValues(0xfd8950) release_rc_XColor(0xfd7640) release_rc_XGCValues(0xfd7790) release_rc_XColor(0xfd53f0) release_rc_XGCValues(0xfd5850) XFree_Screen(0xfc8900) *** glibc detected *** ../../gsi/gsi: munmap_chunk(): invalid pointer: 0x0000000000fc8900 *** ======= Backtrace: ========= /lib/libc.so.6(+0x71ad6)[0x2b7e851c1ad6] /usr/lib/libX11.so.6(XFree+0x9)[0x2b7e85b60ec9] /home/dab/src/gambc-v4_6_0/examples/Xlib-simple/Xlib.o1(XFree_Screen+0x2f)[0x2b7e854d0d4b] ../../gsi/gsi(___release_foreign+0x4d)[0x4c6832] ../../gsi/gsi(___garbage_collect+0x9b0)[0x4c42f9] ../../gsi/gsi[0x4deedd] ../../gsi/gsi(___call+0x104)[0x4c10f3] ../../gsi/gsi(___setup+0xf47)[0x4c20bb] ../../gsi/gsi(___main+0x9c5)[0x4d6eba] ../../gsi/gsi(___main_char+0x66)[0x4cb32d] ../../gsi/gsi(main+0x15)[0x4bf8b5] /lib/libc.so.6(__libc_start_main+0xfd)[0x2b7e8516ec4d] ../../gsi/gsi[0x4bd369] ======= Memory map: ======== [ . . .]
To verify, commenting out the XFree(p) call in XFree_Screen 'fixes' the problem too.
However, while trying this from a different machine this morning I came across a rather strange effect. If I'm running it to a remote X display, it doesn't crash. Only crashes if the bounce program is running on the same machine as my display
Could it be that your Xlib is returning a pointer to a statically allocated Screen structure? It is hard to tell from the Xlib documentation what is guaranteed to be a freshly allocated structure and what can be statically allocated. Do you know?
Marc