Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Apr 2008 00:57:20 -0400 (EDT)
From:      "Mikhail T." <mi@aldan.algebra.com>
To:        FreeBSD-gnats-submit@freebsd.org
Cc:        x11@freebsd.org
Subject:   XCreateImage fails in most recent XOrg
Message-ID:  <200804200457.m3K4vKBI078635@aldan.algebra.com>

next in thread | raw e-mail | index | archive | help

>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@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);
}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200804200457.m3K4vKBI078635>