XCreateImage fails in most recent XOrg

Mikhail T. mi at aldan.algebra.com
Sun Apr 20 05:18:40 UTC 2008


>Submitter-Id:	current-users
>Originator:	Mikhail T.
>Organization:	Virtual Estates, Inc. (http://sybpipe.com/)
>Confidential:	no 
>Synopsis:	XCreateImage fails in most recent XOrg
>Severity:	critical
>Priority:	medium
>Category:	ports
>Class:		sw-bug
>Release:	FreeBSD 7.0-STABLE amd64
>Environment:
System: FreeBSD aldan.algebra.com 7.0-STABLE FreeBSD 7.0-STABLE #0: Sat Mar 8 16:02:37 EST 2008 root at aldan.algebra.com:/meow/obj/var/src/sys/SILVER-SMP amd64

>Description:
	XCreateImage seems to fail quite often now... The attached
	program, for example, fails for me (depth 24), but succeeds,
	if I hardcode the depth at 8.

	The program reports success, when compiled on RedHat 4 with
	its older X11 build.

	The example below is fairly artificial, but a real-world program
	fails to run -- crashes trying to use the result of
	XCreateImage().

	I'm talking about the editors/xcoral port.

>How-To-Repeat:

#include <stdio.h>
#include <stdlib.h>
#include <sys/file.h>
#include <ctype.h>

#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>

#include <X11/Xlib.h>
#include <X11/Xutil.h>

int
main(int argc, char **argv)
{
	Display *display;
	int screen, depth;
	XImage *xi;
	Visual *visual;

	if ((display = XOpenDisplay(NULL)) == NULL) {
		fprintf(stderr, "Can not connect to Xserver. \n");
		exit(1);
	}
	screen = DefaultScreen(display);
	visual = DefaultVisual(display, screen);
	depth = DefaultDepth(display, screen);

	xi = XCreateImage(display, visual,
	    depth, ZPixmap, 0, 0, 24, 24, 32, 72);

	if (xi == NULL) {
		fprintf(stderr, "XCreateImage failed (depth %d).\n", depth);
		exit(2);
	} else
		fprintf(stderr, "XCreateImage succeeded (depth %d).\n", depth);
	XDestroyImage(xi);
	XCloseDisplay(display);

	exit(0);
}


More information about the freebsd-x11 mailing list