From 4c56765da3e4d85a0b46f3d203edbc333539e589 Mon Sep 17 00:00:00 2001 From: Eugene Doudine Date: Fri, 21 Feb 2014 13:34:04 +0200 Subject: [PATCH] Fix for several segfaults in dtwm that happen with UTF-8 locale and were caused by unckeked XmeRenderTableGetDefaultFont return value --- cde/lib/DtWidget/Control.c | 12 +++++++----- cde/programs/dtwm/Clock.c | 11 ++++++++--- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/cde/lib/DtWidget/Control.c b/cde/lib/DtWidget/Control.c index dc414a75..675d553e 100644 --- a/cde/lib/DtWidget/Control.c +++ b/cde/lib/DtWidget/Control.c @@ -1716,7 +1716,6 @@ UpdateGCs( XtGCMask value_mask; XmManagerWidget mw = (XmManagerWidget) XtParent(g); XFontStruct * font; - Boolean font_rtn; if (!G__DoUpdate (g)) return; @@ -1736,16 +1735,19 @@ UpdateGCs( /* Get normal GC. */ - font_rtn = XmeRenderTableGetDefaultFont (G_FontList (g), &font); - value_mask = GCForeground | GCBackground | GCFont | GCFillStyle; + value_mask = GCForeground | GCBackground | GCFillStyle; + if (XmeRenderTableGetDefaultFont (G_FontList (g), &font)) { + value_mask |= GCFont; + values.font = font->fid; + } + if (G_UseEmbossedText (g)) values.foreground = WhitePixelOfScreen (XtScreen (g)); else values.foreground = G_Foreground (g); values.background = G_Background (g); - values.fill_style = FillSolid; - values.font = font->fid; + G_NormalGC (g) = XtGetGC ((Widget)mw, value_mask, &values); /* Get top shadow GC. diff --git a/cde/programs/dtwm/Clock.c b/cde/programs/dtwm/Clock.c index 7d7dea89..0bc38a85 100644 --- a/cde/programs/dtwm/Clock.c +++ b/cde/programs/dtwm/Clock.c @@ -1027,8 +1027,13 @@ else if (G_ClockHandGC (g)) /* Get clock hand GC. */ -font_rtn = XmeRenderTableGetDefaultFont (G_FontList (g), &font); -value_mask = GCForeground | GCFont | GCFillStyle; + +value_mask = GCForeground | GCFillStyle; + +if (XmeRenderTableGetDefaultFont (G_FontList (g), &font)) { + value_mask |= GCFont; + values.font = font->fid; +} if (((G_PixmapForeground (g) == WhitePixelOfScreen (XtScreen (g))) && (G_PixmapBackground (g) == BlackPixelOfScreen (XtScreen (g)))) || @@ -1038,7 +1043,7 @@ if (((G_PixmapForeground (g) == WhitePixelOfScreen (XtScreen (g))) && else values.foreground = mw->manager.top_shadow_color; values.fill_style = FillSolid; -values.font = font->fid; + G_ClockHandGC (g) = XtGetGC ((Widget) mw, value_mask, &values); -- 2.25.1