From: Eugene Doudine Date: Fri, 21 Feb 2014 11:52:25 +0000 (+0200) Subject: Fixes segfault in dtprintinfo when used UTF-8 locale, bug was caused by unchecked... X-Git-Tag: 2.2.1~9 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=23e217b3291ffa5776aad00919bc2b30c6625d56;p=oweals%2Fcde.git Fixes segfault in dtprintinfo when used UTF-8 locale, bug was caused by unchecked return value of XmeRenderTableGetDefaultFont() --- diff --git a/cde/programs/dtprintinfo/libUI/MotifUI/Application.C b/cde/programs/dtprintinfo/libUI/MotifUI/Application.C index 33d4c363..383c6a7c 100644 --- a/cde/programs/dtprintinfo/libUI/MotifUI/Application.C +++ b/cde/programs/dtprintinfo/libUI/MotifUI/Application.C @@ -96,7 +96,7 @@ static XrmOptionDescRec options[] = }; extern "C" { - extern void XmeRenderTableGetDefaultFont(XmFontList, XFontStruct **); + extern Boolean XmeRenderTableGetDefaultFont(XmFontList, XFontStruct **); } Application::Application(char *name, @@ -151,9 +151,12 @@ Application::Application(char *name, { XmFontType _type_return; fs = (XFontStruct *)XmFontListEntryGetFont(entry, &_type_return); - if (_type_return != XmFONT_IS_FONT) + if (_type_return != XmFONT_IS_FONT) { XmeRenderTableGetDefaultFont(userFont, &fs); - font = fs->fid; + } + if (fs) { + font = fs->fid; + } } XmFontListFreeFontContext(context); } diff --git a/cde/programs/dtprintinfo/libUI/MotifUI/DtDND.C b/cde/programs/dtprintinfo/libUI/MotifUI/DtDND.C index 1c0631c5..3316a3e1 100644 --- a/cde/programs/dtprintinfo/libUI/MotifUI/DtDND.C +++ b/cde/programs/dtprintinfo/libUI/MotifUI/DtDND.C @@ -93,7 +93,9 @@ DtDND::DtDND(MotifUI *_obj, DNDCallback _dndCB, boolean _can_drop_on_root) gc = XCreateGC(tmp->display, tmp_pixmap, 0, NULL); tmp_pixmap = XCreatePixmap(tmp->display, tmp->root, 1, 1, 1); gc_mask = XCreateGC(tmp->display, tmp_pixmap, 0, NULL); - XSetFont(tmp->display, gc, tmp->font); + if (tmp->font) { + XSetFont(tmp->display, gc, tmp->font); + } FirstTime = false; }