On 11/27/2016 11:02 AM, Ken Brown wrote: > On 11/27/2016 9:03 AM, Girish Joglekar wrote: >> Hi Ken, >> Thank you for your reply on the Cygwin mailing list. I have created a >> slightly smaller test example smaller than what I had created in Feb. >> Attached is a tar file. After make insall if you run TEST.x and click >> the Open button, it gives segmentation fault. >> Hope you will be able to help. >> Thank you. >> Girish > > Please keep the discussion on the mailing list so that people who might > be able to help will see it. I personally am not familiar with X11 > programming, so I'm not one of those people. > > I do have a few comments, however: > > 1. This may be slightly smaller than your previous program, but it is > still *very* far from a small test case. You really can't expect people > to debug a program of this size for you. > > 2. I suggest that you build with -Wall (as Marco already suggested in > the earlier discussion) and fix all the compiler warnings. I saw > several that need attention (aside from the many "unused variable" > warnings). It wouldn't hurt to also use -Wextra. > > 3. I also suggest that you use gdb to find out where the program is > crashing and why. You made a start on that in the discussion last > March, but you didn't follow through. (By the way, I recommend building > without optimization; otherwise you may not be able to get accurate > information about the crash from gdb.) > > 4. If, after the steps above, you still think the crash is due to a > Cygwin bug rather than a programming error, then try to extract from > your program a test case as small as possible that reproduces the crash. I've looked at this a little, and the crash occurs because of a bad value of a pointer to a font list. I'm attaching an annotated transcript of a gdb session that illustrates this. I didn't try to figure out where the bad pointer came from. As a workaround, you can avoid the crash by removing from mosprshx.c all uses of spreadSheetFont, as in the following patch: --- mosprshx.c~ 2016-11-27 08:46:12.000000000 -0500 +++ mosprshx.c 2016-11-29 14:58:23.114377500 -0500 @@ -29,8 +29,6 @@ 0x00, 0x7c, 0x07, 0x1e, 0x0f, 0x07, 0x9e, 0x03, 0xfc, 0x01, 0xf8, 0x00, 0x70, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00}; -static char *spreadSheetFont = "-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1"; - #ifdef __STDC__ static void mosprshCreateCheckMarkPixmap(Widget pushButton) #else @@ -208,11 +206,6 @@ if(isParentManaged) XtUnmanageChild(parentFM); - fromValue.addr = spreadSheetFont; - fromValue.size = utStringLength(fromValue.addr) + 1; - toValue.addr = NULL; - XtConvertAndStore(parentFM,XmRString,&fromValue,XmRFontList,&toValue); - ac = 0; XtSetArg(al[ac],XmNuserData,(XtPointer)spreadSheetSize); ac++; spreadSheet = XmCreateForm(parentFM,"SpreadSheet",al,ac); @@ -234,9 +227,6 @@ XtSetArg(al[ac],XmNtraversalOn,FALSE); ac++; } XtSetArg(al[ac],XmNcolumns,longestFixedColumnSize+1); ac++; - if(toValue.addr) { - XtSetArg(al[ac],XmNfontList,*(unsigned int *)toValue.addr); ac++; - } for(i1=0 ; i1 0) { XtSetArg(al[ac],XmNcolumns,cellSize); ac++; } - if(toValue.addr) { - XtSetArg(al[ac],XmNfontList,*(unsigned int *)toValue.addr); ac++; - } for(j1=0 ; j1