SegFault with XCloseDisplay(dpy)

Florent Monnier fmonnier at linux-nantes.fr.eu.org
Sun May 14 11:13:29 PDT 2006


> > At the end of my demo when I call
> >   XCloseDisplay(dpy);
> > this produces a segmentation fault.
> >
> > How can I make to find where this error could come from ?
>
> See if dpy is a valid pointer by dereferencing it in gdb.

Sorry for the noise I've just found my error. I was freeing the var (Screen *) 
just before closing the display, and in fact (a) XCloseDisplay() does the job, 
and (b) there is no need to malloc the pointer (Screen *)screen since this 
job is done too by the function that has a return type (Screen *).
In fact I'm a beginner with C, and I'm trying to wrap xlib for ocaml:
http://www.linux-nantes.org/~fmonnier/OCaml/Xlib/
http://www.linux-nantes.org/~fmonnier/tmp/img/X-sin.png

-- thanks


More information about the xorg-arch mailing list