Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

Motif FAQ (Part 4 of 9)
Section - 88) Can you reuse the return value from XtParseTranslationTable?

( Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Part8 - Part9 - Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Business Photos and Profiles ]


Top Document: Motif FAQ (Part 4 of 9)
Previous Document: 87) Why does pressing RETURN in a text widget do nothing? This
Next Document: 89) When I add text to a scrolling text widget, how can I get the
See reader questions & answers on this topic! - Help others by sharing your knowledge
[Last modified: Nov 96]

Answer: The following is a conversation circa 30 Sep 1996 between Kaleb
Keithley (kaleb@x.org) and Tim Behrendsen (tim@a-sis.com, tim@airshields.com>.
The latter suggested this appear in the Motif FAQ.

B> Can the return value from XtParseTranslationTable be saved
TB> off and reused for the lifetime of the application?

KK> Yes.

TB> Ah!  The answer.  Thank you.
KK>
KK>    XtVaSetValues(widget,
KK>        XmNtranslations, XtParseTranslationTable(table), NULL);

TB> which implies it's a one-shot deal (otherwise, this would cause
TB> a memory leak).

KK> No, you can always retrieve them with Xt(Va)GetValues.

TB> You can, but if you don't and use the technique to wantonly
TB> create and destroy dialogs, it seems you will get a memory
TB> leak.

KK> That's correct.

TB> In fact, what's scary is this technique is used in the Motif
TB> FAQ list; I knew I saw it somewhere reasonably authoritative
TB> ([approx.] Question 133; code by Dan Heller, O'Reilly and Associates).
TB> He does the following:

TB>        XtOverrideTranslations(bboard,
TB>             XtParseTranslationTable("<Configure>: resize()"));

TB> This has to be unquestionably broken code, if the translation
TB> tables are never freed or never reused.  Obviously, I can't
TB> extract out the table from overridden translations.

KK> You can't extract the original translations, that's correct.

TB> Come to think of it; how is this handled when translations are
TB> parsed in resource files?  If I have lots of translation
TB> overrides, do they simply burn up space that can't be reused?
TB> Does it get burned up over and over as I create widgets that
TB> use those translation resources?

KK> Yup and yup.


User Contributions:

Comment about this article, ask questions, or add new information about this topic:

CAPTCHA




Top Document: Motif FAQ (Part 4 of 9)
Previous Document: 87) Why does pressing RETURN in a text widget do nothing? This
Next Document: 89) When I add text to a scrolling text widget, how can I get the

Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Part8 - Part9 - Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
kenton@rahul.net (Ken Lee)





Last Update March 27 2014 @ 02:11 PM