XmFontListFree segmenentation faults.

This forum is read only. No new submissions are accepted.

Questions about motif? Contact us

2 posts / 0 new
Last post
XmFontListFree segmenentation faults.

Submitted by Anonymous on Tue, 08/22/2000 - 14:06. Developers
Can someone explain to me why this program seg faults on Linux (Debian GNU/Linux v2.2 Potato) with OpenMotif v 2.1.30?
It works just fine on SCO with Motif v 1.2.

#include

int main (void)
{
XmFontListEntry FontListEntry;
XmFontList FontList;
XFontStruct *FontStruct;

Display *display;

char *FontName = "6x13medium";

display = XOpenDisplay (NULL);

FontStruct = XLoadQueryFont (display, FontName);
FontListEntry = XmFontListEntryCreate (XmFONTLIST_DEFAULT_TAG, XmFONT_IS_FONT, (XtPointer)FontStruct);
FontList = XmFontListAppendEntry (NULL, FontListEntry);

XmFontListEntryFree (&FontListEntry);
XmFontListFree (FontList);

XCloseDisplay (display);

return (0);
}

Here is the stack trace from gdb.

(gdb) r
Starting program /home/pcmoen/source/fontlist

Program received signal SIGSEGV, Segmentation fault.
0x4013ca8a in XmRenderTableFree () from /usr/X11R6/lib/libXm.so.2
(gdb) bt
#0 0x4013ca8a in XmRenderTableFree () from /usr/X11R6/lib/libXm.so.2
#1 0x401347bc in XmFontListFree () from /usr/X11R6/lib/libXm.so.2
#2 0x8048763 in main () at fontlist.c19
(gdb) q

Anonymous

Found the fault.
Font 6x13medium was not available on the X server.
(Yeah should have checked the return values from XLoadQueryFont, and if the FontList contained data before freeing it. Doing this now)

What bugs me now is that the code worked perfecly on SCO with the same X Server.