Path: utzoo!mnetor!uunet!husc6!ukma!nrl-cmf!ames!pasteur!postgres!grady From: grady@postgres (Steven Grady) Newsgroups: comp.windows.x Subject: X11 bounce errors Message-ID: <2219@pasteur.Berkeley.Edu> Date: 8 Apr 88 19:12:43 GMT Sender: news@pasteur.Berkeley.Edu Reply-To: grady@postgres.berkeley.edu (Steven Grady) Organization: Postgres Research Group, UC Berkeley Lines: 31 Many people have pointed out my stupid mistake in the bounce program I posted a couple days ago. I had just changed the code to allow an abitrary number of windows, rather then a fixed maximum, but I forgot to cast the result of the malloc. The stupid thing is that I somehow missed the warnings from the compiler. Anyway, here's the patch: *** bounce.c.old Fri Apr 8 12:08:08 1988 --- bounce.c Fri Apr 8 12:09:33 1988 *************** *** 145,152 **** XQueryTree(dpy, DefaultRootWindow(dpy), &root, &par, &children, &n); /* Malloc() never fails. Heh heh.. */ ! windows = malloc(n * sizeof(*windows)); ! savedwins = malloc(n * sizeof(*savedwins)); for (i = 0, j = 0; i < n; i++) { XGetWindowAttributes(dpy, children[i], &winf); if (winf.map_state == IsViewable) { --- 145,152 ---- XQueryTree(dpy, DefaultRootWindow(dpy), &root, &par, &children, &n); /* Malloc() never fails. Heh heh.. */ ! windows = (struct window *) malloc(n * sizeof(*windows)); ! savedwins = (struct window *) malloc(n * sizeof(*savedwins)); for (i = 0, j = 0; i < n; i++) { XGetWindowAttributes(dpy, children[i], &winf); if (winf.map_state == IsViewable) { Steven grady@postgres.berkeley.edu ...!ucbvax!grady