* Bernhard R. Link <[EMAIL PROTECTED]> [070701 15:55]:
> Thanks for testing this. Now I 'only' have to find out why it crashes for
> you but not for me. (Though I have not yet tested with your fonts or
> with a real X server (opposed to Xephyr) or the same libs (except
> libx11)).

After learning a lot about how Xlib caches its events, extending xtrace
to tell me more about some obscure extensions xlib is using and finding
(most likely totally) unrelated bugs in ratpoison while searching for
this one, and trying to reproduce with all things the same version I'm
still lost. So here some more tests and questions, though I have to
admit they are mostly guessing into the dark...

> That may need some days before I can tell more. (Or have ideas for new 
> testcases...)
> * H. S. Teoh <[EMAIL PROTECTED]> [070701 15:40]:
> > Yep, it crashes. Although, the way the program is written is rather
> > tricky to test, since it exits on keystrokes, so I have to hit C-t w
> > before starting it. :-)

Attached is a new version of the test program, that should be less
sesnsitive to key events.

Could you test if it also shows the behaviour of aborting when showing
the window list after program started? (and not while the program is
running).

There is a loop to 1000 near the end of the program. Does it also happen
if that loop is removed?

Does it also happen without the font or the winfmt set?
(try starting ratpoison with -f /dev/null to make it omit your
.ratpoisonrc). Both the test program and opera would be intresting.

What locale is your ratpoison running with? Does the bug still show up,
if ratpoison is running in en_US (without .UTF-8) locale?
(You might need to generate that first to make sure it can be used, if
it is not in /etc/locale.gen yet).

Is a locally build ratpoison still unable to reproduce the problem?
(if it is now with more knowledge what triggers it, a backtrace with
 debug symbols would be intresting).

Even without debug symbols for ratpoison, does the backtrace give any
further hints where this happens? (well, there is a good chance that
even if this place is located, it might just be something else wanting
memory after the faulty part ate all of it, but at least there is a
chance it is the buggy part).
Installing libx11-dbg might give more hints if xlib calls are involved.

Could you try running ratpoison in valgrind --tool=massif and send me
the .txt files it generates? (Best one time for opera and one time for
the xfakewindow program)

Thanks in advance,
        Bernhard R. Link
#include <assert.h>
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>

#include <X11/X.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>

int main(int argc, char *argv[]) {
	Display *display;
	int screen;
	Visual *visual;
	Window w;
	XSetWindowAttributes attributes = {
		.background_pixel= 0,
		.event_mask = KeyPressMask,
	};
	Status s;
	char *names[] = { "Intel\302\256 Motherboards - Opera"};
	XTextProperty text,tt;
	XEvent event;
	struct {
		const char *name;
		XICCEncodingStyle style;
		char *list[2]; int nlist;
		Atom atom;
	} properties[] = {
		{"WM_CLIENT_MACHINE", XStringStyle, {"crystal"}, 1},
		{"WM_LOCALE_NAME", XStringStyle, {"en_US.UTF-8"},1},
		{"WM_WINDOW_ROLE", XStringStyle, {"opera-mainwindow#1"},1},
		{"OPERA_VERSION", XStringStyle, {"Opera 9.21"},1},
		{"OPERA_USER", XStringStyle, {"1000"},1},
		{"OPERA_PREFERENCE", XStringStyle, {"/home/hsteoh/.opera"},1},
		{"_NET_WM_NAME", XUTF8StringStyle,
			{"Intel\302\256 Motherboards - Opera"},
		1}
	};
	XClassHint classhint = {"opera", "Opera"};
	Atom _NET_WM_PID;
	long pid = getpid();
	int i;

	display = XOpenDisplay(getenv("DISPLAY"));
	if( display == NULL )
		return 1;
	screen = DefaultScreen(display);
	visual = DefaultVisual(display,screen);

	for( i = 0 ; i < sizeof(properties)/sizeof(properties[0]) ; i++ ) {
		properties[i].atom = XInternAtom(display, properties[i].name, False);
	}
	_NET_WM_PID = XInternAtom(display, "_NET_WM_PID", False);

	w = XCreateWindow(display, RootWindow(display,screen), 0, 0, 100, 100, 1,
			DefaultDepth(display,screen), InputOutput,
			visual, CWBackPixel|CWEventMask, &attributes);
	s = Xutf8TextListToTextProperty(display, names, 1, XStringStyle, &text);
	XSetClassHint(display, w, &classhint);
	XSetWMName(display, w, &text);
	for( i = 0 ; i < sizeof(properties)/sizeof(properties[0]) ; i++ ) {
		properties[i].atom = XInternAtom(display, properties[i].name, False);
		s = Xutf8TextListToTextProperty(display,
				properties[i].list,
				properties[i].nlist,
				properties[i].style, &tt);
		assert( s == 0 );
		XSetTextProperty(display, w, &tt, properties[i].atom);
	}
	XChangeProperty(display, w, _NET_WM_PID, XA_CARDINAL, 32,
			PropModeReplace, (unsigned char*)&pid, 1);
	XMapWindow(display, w);
	XSync(display, False);
	for( i = 0 ; i < 1000 ; i++ ) {
		XSetWMName(display, w, &text);
		XSync(display, False);
	}
	while( 1 ) {
		XNextEvent(display,&event);
		if( event.type == KeyPress && event.xkey.keycode == 24)
			break;
	}
	XUnmapWindow(display, w);
	XDestroyWindow(display, w);
	XSync(display, False);
	return 0;
}

Reply via email to