Subject: Re: bug: xfig crashes
To: Jan Danielsson <jan.m.danielsson@gmail.com>
From: Tobias Nygren <tnn@NetBSD.org>
List: netbsd-users
Date: 04/18/2007 12:21:20
This is a multi-part message in MIME format.
--------------060708090605040104030601
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Tobias Nygren wrote:
> Jan Danielsson wrote:
>> Hello all,
>>
>>    I can no longer use xfig. It crashes when I click the "File" menu.
>>
>>    NetBSD/amd64 3.1 & pkgsrc-current.
>>
>>   
>
> I was able to reproduce it on NetBSD/amd64 4.99.17 w/ X11_TYPE=modular.
> Looks like a problem with Xaw.
>
> (gdb) bt
> #0  0x00007f7ffd2279d0 in Redisplay () from /usr/pkg/lib/libXaw3d.so.8
> #1  0x00000000004b63d9 in Redisplay ()
> #2  0x00007f7ffce20c85 in SendExposureEvent () from 
> /usr/pkg/lib/libXt.so.6
> #3  0x00007f7ffce21103 in XtDispatchEventToWidget ()
>   from /usr/pkg/lib/libXt.so.6
> #4  0x00007f7ffce216e1 in _XtDefaultDispatcher () from 
> /usr/pkg/lib/libXt.so.6
> #5  0x00007f7ffce208eb in XtDispatchEvent () from /usr/pkg/lib/libXt.so.6
> #6  0x00000000004413ac in main ()
>

... which is a NULL pointer dereference. I have no idea how to fix
this properly, but I've attached a patch that works around it.
I suggest you open a pkg problem report about this.

#0  0x00007f7ffd231596 in Redisplay (w=0x777d80, event=0x0, region=0x0)
    at SmeLine.c:220
#1  0x000000000052e4f4 in Redisplay (w=0x770e00, event=0x7f7fffffe6f0,
    region=0x75d1c0) at SimpleMenu.c:348



--------------060708090605040104030601
Content-Type: text/plain;
 name="patch-ad"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="patch-ad"

$NetBSD$
pkgsrc/x11/Xaw3d: Q&D workaround for graphics/xfig bug on amd64

--- xc/lib/Xaw3d/SmeLine.c.orig	2007-04-18 12:10:15.000000000 +0200
+++ xc/lib/Xaw3d/SmeLine.c
@@ -217,7 +217,7 @@ Region region;
     SmeLineObject entry = (SmeLineObject) w;
     SimpleMenuWidget smw = (SimpleMenuWidget) XtParent (w);
     ThreeDWidget tdw = (ThreeDWidget) smw->simple_menu.threeD;
-    Dimension s = tdw->threeD.shadow_width;
+    Dimension s = tdw?tdw->threeD.shadow_width:0;
     int y = entry->rectangle.y + 
 	    (int)(entry->rectangle.height - entry->sme_line.line_width) / 2;
 

--------------060708090605040104030601--