Fixes segfault in dtprintinfo when used UTF-8 locale, bug was caused by unchecked...
authorEugene Doudine <dudinea@gmail.com>
Fri, 21 Feb 2014 11:52:25 +0000 (13:52 +0200)
committerJon Trulson <jon@radscan.com>
Sun, 23 Feb 2014 02:07:52 +0000 (19:07 -0700)
cde/programs/dtprintinfo/libUI/MotifUI/Application.C
cde/programs/dtprintinfo/libUI/MotifUI/DtDND.C

index 33d4c3630394ecf883cc954966e930d3e7368b69..383c6a7c5b735028001f5d9a29c68c1aeb7755c4 100644 (file)
@@ -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);
        }
index 1c0631c5f8cdc87a88d5fb80e3defa86d6bf522b..3316a3e158d88ad7dc839d8b64870d9bafc611c3 100644 (file)
@@ -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;
     }