From 23e217b3291ffa5776aad00919bc2b30c6625d56 Mon Sep 17 00:00:00 2001 From: Eugene Doudine Date: Fri, 21 Feb 2014 13:52:25 +0200 Subject: [PATCH] Fixes segfault in dtprintinfo when used UTF-8 locale, bug was caused by unchecked return value of XmeRenderTableGetDefaultFont() --- cde/programs/dtprintinfo/libUI/MotifUI/Application.C | 9 ++++++--- cde/programs/dtprintinfo/libUI/MotifUI/DtDND.C | 4 +++- 2 files changed, 9 insertions(+), 4 deletions(-) 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; } -- 2.25.1