| > If I call DWT$GET_VALUES to ask for the label of a widget (using DWT$C_NLABEL),
> is the value given to me that of a copy of the label's compound string (which
> I can then later free) or is it simply a pointer to the toolkit's string
> that I should not modify or free?
It is a pointer to a compound string that you should not modify or free.
In fact, if you need the value for any length of time you should call
DwtCStrcpy to make a copy.
> And has this changed between DECwindows V1 and V2?
The fact that you shouldn't modify or free it hasn't changed. How the
toolkit *gets* the value that you get back did change. V1 used to
always hang on to the compound string. V2 only hangs on to an internal
format and regenerates the compound string on the call to XtSetValues.
The toolkit frees this regenerated string when the string changes, or
the widget is deleted. This change saved lots of memory.
Leo
|
| Thanks, Leo. I will make the requisite changes to DECBURGER (and
comment them profusely!)
May I suggest that there be some clear and obvious documentation about
what one can and cannot do with values returned by GET_VALUES? (Or
if there is, please point me to it!)
Steve
|
| It is my understanding that the rule is very simple. The application should
never free anything returned by XtGetValues. I can't remember where I read
this, if anywhere, but it is the guideline under which (most?) widget writers
operate.
This rule does not necessarily apply to "special" routines, like
DwtSTextGetString, etc, which are individually documented. The
documentation for each of these routines should (must) indicate
the required disposition of the returned memory.
-steve-
|