Bug#71935: tetex-bin: xdvi segfaults with -nogrey
"BF" == Bernd Feige <charly@pst15.ukl.uni-freiburg.de> writes:
BF> Package: tetex-bin Version: 1.0.7+20000807-1 Severity:
BF> important
BF> Dear tetex maintainer,
BF> Subject says it all. I had XDvi*grey set to false, so the
BF> package didn't work for me at all at first. Try
BF> /usr/X11R6/bin/xdvi.real -nogrey anything.dvi
BF> The other parameters don't appear to change
BF> anything. Strangely, the 'G' keypress is able to switch
BF> antialiasing off...
Okay.
What's happening is that the copyGC (Graphics Context) pointer is
set to null because it was never initialized.
The segfault happens when copyGC is passed into XDrawImageString
on line 2032 of texk/xdvik/events.c:
XDrawImageString(DISP, mane.win, copyGC,
5 - window_x, 5 + X11HEIGHT - window_y, message, strlen(message));
When using greyscale, copyGC is defined by the init_pix()
function. Without greyscale (i.e., with the -nogrey flag), copyGC
is never initialized, which causes xdvi to crash in
XDrawImageString.
The following patch adds a line to the appropriate function that
initializes copyGC, which allows xdvi to run with the -nogrey
flag.
--- texk/xdvik/events.c.orig Sun Aug 22 06:33:35 1999
+++ texk/xdvik/events.c Mon Sep 18 13:11:44 2000
@@ -876,6 +876,7 @@
GCFunction|GCForeground|GCBackground, &values))
foreGC = foreGC2 = ruleGC = NULL;
+ copyGC = MakeGC(GXcopy, fore_Pixel, back_Pixel);
if (copy || (set_bits && clr_bits))
ruleGC = MakeGC(GXcopy, fore_Pixel, back_Pixel);
if (copy) foreGC = ruleGC;
Solution: Apply the patch and rebuild the package.
CMC
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
Behind the counter a boy with a shaven head stared vacantly into space,
a dozen spikes of microsoft protruding from the socket behind his ear.
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
C.M. Connelly c@eskimo.com SHC, DS
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
Reply to: