[comp.windows.x.motif] Problems freeing an XFontStruct

toml@marvin.Solbourne.COM (Tom LaStrange) (04/12/91)

I'm having problems freeing an XFontStruct, here's the code:

	GC gc;
	XFontStruct *fsp;

	gc = XCreateGC(dpy, win, 0, 0);
	fsp = XQueryFont(dpy, XGContextFromGC(gc));
	XFreeFont(dpy, fsp);

This generates the following protocol error:

X Error of failed request:  BadFont (invalid Font parameter)
  Major opcode of failed request:  46 (X_CloseFont)
  Resource id in failed request:  0x1500002
  Serial number of failed request:  6
  Current serial number in output stream:  11

I presume because the font ID in the XFontStruct is actually the graphics
context ID and XFreeFont() assumes it's a font ID.

So is it possible to free a font structure obtained using a GC rather
than a font ID?

--
(I kid you not)Tom LaStrange        toml@Solbourne.COM