rcb@cccvs1.ncsu.edu (Randy Buckland) (06/14/89)
In the XGetWindowProperty call, you get back a pointer to the property data. Should this be freed or not. I can't find anything in the documentation that goes either way. Randy Buckland rcb@ncsuvx.ncsu.edu
jim@EXPO.LCS.MIT.EDU (Jim Fulton) (06/15/89)
> In the XGetWindowProperty call, you get back a pointer to the property data. > Should this be freed or not. I can't find anything in the documentation > that goes either way. Yes it should be released with XFree().* *(page 73 of Scheifler, Gettys, and Newman)
klee@gilroy.pa.dec.com (Ken Lee) (06/15/89)
In article <3174@ncsuvx.ncsu.edu>, rcb@cccvs1.ncsu.edu (Randy Buckland) writes: > In the XGetWindowProperty call, you get back a pointer to the property data. > Should this be freed or not. I can't find anything in the documentation > that goes either way. According to Section 4.3 of the Xlib manual (X11R3): To free the resulting data, use XFree. In general, any user data allocated by an Xlib function may be freed with XFree. Ken Lee DEC Western Software Laboratory, Palo Alto, Calif. Internet: klee@decwrl.dec.com Uucp: uunet!decwrl!klee
carroll@s.cs.uiuc.edu (06/19/89)
In article <3174@ncsuvx.ncsu.edu>, rcb@cccvs1.ncsu.edu (Randy Buckland) writes: > In the XGetWindowProperty call, you get back a pointer to the property data. > Should this be freed or not. I can't find anything in the documentation > that goes either way. [ ... answer about Xfree ... ] Should you Xfree() if the XGetWindowProperty() calls returns a non-Success value? Also, on a related topic, XLoadQueryFont() returns a structure that should be freed. Can I use XFree on it? The manual (11.3) says to use XFreeFontInfo(), but that wants a list of names as it's first argument - where do I get that? And what possible purpose is there in passing them? The names are supposed to be a list returned by XListFontsWithInfo(), but the name (singular) that I have was generated elsewhere - if it gets freed, things will break in a bad way. Should I pass a NULL pointer for the names in XFreeFontInfo(), or just use XFree()? Thanks! Alan M. Carroll "And there you are carroll@s.cs.uiuc.edu Saying 'We have the Moon, so now the Stars...'" CS Grad / U of Ill @ Urbana ...{ucbvax,pur-ee,convex}!s.cs.uiuc.edu!carroll
rws@EXPO.LCS.MIT.EDU (06/20/89)
Should you Xfree() if the XGetWindowProperty() calls returns a non-Success value? No. Also, on a related topic, XLoadQueryFont() returns a structure that should be freed. Can I use XFree on it? No, use XFreeFont. The manual (11.3) says to use XFreeFontInfo() My version of the manual says XFreeFont. Please cite chapter and verse.
klee@gilroy.pa.dec.com (Ken Lee) (06/20/89)
In article <216500009@s.cs.uiuc.edu>, carroll@s.cs.uiuc.edu writes: > Also, on a related topic, XLoadQueryFont() returns a structure that > should be freed. Can I use XFree on it? The manual (11.3) says to use > XFreeFontInfo(), No, the manual says "To unload the font and free the storage used by the font structure that was allocated by XQueryFont or XLoadQueryFont, use XFreeFont." XFree frees memory on only the client (Xlib) side, but you don't want to do that since a font is allocated in both the client and the server. XFreeFontInfo frees an information array generated by XListFontsWithInfo. Ken Lee DEC Western Software Laboratory, Palo Alto, Calif. Internet: klee@decwrl.dec.com Uucp: uunet!decwrl!klee
carroll@s.cs.uiuc.edu (06/23/89)
RE: XFreeFont() vs. XFreeFontInfo() Apparently I stated myself badly originally. The statement "the manual says to use XFreeFontInfo()" is on page 94, "Xlib - C Library X11, Release 3" under the function XQueryFont(), where it says "To free this data, use XFreeFontInfo()" I can't use XFreeFont(), because what I want to free is the _info_, not the font. I use XLoadQueryFont(), which does an implicit XQueryFont() (which is why the above section is relevant). I then copy over the bits that I need, and want to dump the _info_ structure because I'm done with it. The key question is, "If I use XQueryFont() (either directly or through XLoadQueryFont()), instead of XListFontsWithInfo(), what do I pass for the names argument in XFreeFontInfo()?". rws told me that the answer is NULL, with an actual_count of 1. I submit that this is non-obvious from reading the manual. Alan M. Carroll "And there you are carroll@s.cs.uiuc.edu Saying 'We have the Moon, so now the Stars...'" CS Grad / U of Ill @ Urbana ...{ucbvax,pur-ee,convex}!s.cs.uiuc.edu!carroll