Hi there

I've come accross an extremely strange and frustrating problem.  I have two versions 
of code that is using ggi.  One works fine.  The other crashes upon ggiEventRead.  
Some gdb output is given below:

(gdb) bt
#0  0x401f2cf4 in _XimLocalFilter () from /usr/X11R6/lib/libX11.so.6
#1  0x401cc2f9 in XFilterEvent () from /usr/X11R6/lib/libX11.so.6
#2  0x4023019e in GII_xwin_eventpoll (inp=0x80506e0, arg=0xbffff81c) at input.c:188
#3  0x4016b3c1 in _giiPollall (inp=0x80506e0, mask=4072, arg=0xbffff81c) at gii.c:568
#4  0x4016c4d4 in giiEventPoll (inp=0x80506e0, mask=4072, timeout=0x0) at unix.c:235
#5  0x4016ba8b in giiEventRead (inp=0x80506e0, ev=0xbffff93c, mask=4072) at gii.c:800
#6  0x4001a796 in ggiEventRead (vis=0x804e3b8, ev=0xbffff93c, mask=4072) at events.c:43
#7  0x80499e9 in ticleFileRequester::GetDirEnt (this=0x8067d20) at 
FileRequester.cpp:232
#8  0x8049617 in ticleFileRequester::RequestFilename (this=0x8067d20) at 
FileRequester.cpp:129
#9  0x80491f3 in ticleFrontEnd::RequestFileName (this=0x804b8a8) at FrontEnd.cpp:106
#10 0x804928a in main () at FrontEnd.cpp:118
(gdb) l FileRequester.cpp:232
227             bool loop_done=false;
228             unsigned int sel_index=0;
229             unsigned int l_bound=0;
230             event_mask =  ggiGetEventMask(Visual);
231             while (!loop_done) {
232                     ggiEventRead(Visual, &event, event_mask);
233                     if (event.any.type == evKeyRepeat || event.any.type == 
evKeyRelease) {
234                       switch(event.key.sym) {
235                         case GIIK_Enter:
236                           printf("Enter\n");


The thing that I cannot get over is that the only differences between the two versions 
is some variablisation of some common calculations. The version that works is in cvs 
while the other is an editted version.  The cvs diff output is below:

node@insanity:~/proj/ticle$ cvs diff
[EMAIL PROTECTED]'s password: 
? ticle.dia
? glade
? t
? src/FrontEnd
cvs server: Diffing .
cvs server: Diffing include
cvs server: Diffing src
Index: src/FileRequester.cpp
===================================================================
RCS file: /cvsroot/ticle/ticle/src/FileRequester.cpp,v
retrieving revision 1.3
diff -r1.3 FileRequester.cpp
42a43,48
>       int DirListLeft;
>       int DirListTop;
>       int DirListWidth;
>       int DirListHeight;
>       int DirListRows;
> 
72a79,84
>       DirListTop = Top+CharWidth*2+8;
>       DirListLeft = Left+1;
>       DirListWidth = Width-2;
>       DirListHeight = Height-CharWidth*2-8;
>       DirListRows = (Height-CharHeight*2-9)/CharHeight;
> 
234,236c246,247

[ This code is not executed before the crash ]

<                       sel_index--;
<                       if (sel_index < l_bound ) {
<                         if (l_bound > 0) l_bound--; else break;
---
>                       if (sel_index == l_bound ) {
>                               l_bound--;
237a249
>                       sel_index--;
244,245c256,259
<                       if (sel_index >= ((Height-CharHeight*2-9)/CharHeight) * 
columns ) {
<                         if (l_bound < dir_ent_count-1) l_bound++; else break;
---
> 
>                       /* If we're at the last displayed entry */
>                       if (sel_index -l_bound  == DirListRows * columns ) {
>                         l_bound++;

[ --- ]

293d306
<       static unsigned int char_rows = (Height-CharHeight*2-9)/CharHeight;;
301,303d313
<       static unsigned int string_y_modifier = Top+(CharHeight*2)+8;
<       static unsigned int string_x_modifier = Left+1;
< 
308c318
<               ggiDrawBox(Visual, Left, Top+CharHeight*2+8, Width, 
Height-CharHeight*2-8);
---
>               ggiDrawBox(Visual, DirListLeft, DirListTop, DirListWidth, 
>DirListHeight);
311c321
<       
---
> 
315,316c325,326
<                                       
string_x_modifier+(column_count*(Width/Columns)),
<                               string_y_modifier+(row_count*CharHeight),
---
>                                       DirListLeft+(column_count*(Width/Columns)),
>                               DirListTop+(row_count*CharHeight),
319c329
<                       if (row_count >= char_rows) {
---
>                       if (row_count >= DirListRows) {
333,334c343,344
<               string_x_modifier+((SelIndex-Lbound)/char_rows)*(Width/Columns),
<               string_y_modifier+((SelIndex-Lbound)%char_rows)*CharHeight,
---
>               DirListLeft+((SelIndex-Lbound)/DirListRows)*(Width/Columns),
>               DirListTop+((SelIndex-Lbound)%DirListRows)*CharHeight,
342,343c352,353
<                       
string_x_modifier+((old_sel_index-Lbound)/char_rows)*(Width/Columns),
<                       
string_y_modifier+((old_sel_index-Lbound)%char_rows)*CharHeight,
---
>                       
>DirListLeft+((old_sel_index-Lbound)/DirListRows)*(Width/Columns),
>                       DirListTop+((old_sel_index-Lbound)%DirListRows)*CharHeight,
348,349c358,359
<                       
string_x_modifier+((old_sel_index-Lbound)/char_rows)*(Width/Columns),
<                       
string_y_modifier+((old_sel_index-Lbound)%char_rows)*CharHeight,
---
>                       
>DirListLeft+((old_sel_index-Lbound)/DirListRows)*(Width/Columns),
>                       DirListTop+((old_sel_index-Lbound)%DirListRows)*CharHeight,
362,363c372
<                                    Top+(CharHeight*2)+8,
<                                    Height-CharHeight*2-9);
---
>                                    DirListTop, DirListHeight);


I've also checked that the gii_event_mask that is passed is the same for the 
giiEventRead calls in the crashing and non-crashing code; 4072.  Changing the mask to 
emNothing works, but obviously isn't any good.

I'm using the ggi snapshot 20000804, Xfree86 3.3.6, gcc/g++ 2.95.2 and glibc 2.1.3.

If someone could please help me get around this I'd be eternally grateful.


Many thanks,

Bob

-- 
Bob Ham:  [EMAIL PROTECTED]   http://flux.mentaltempt.org/~node/
IRC: 'node' on devnull.slashnet.org: #slashdot   ICQ: 4396425

Time City Level Designer
Time City: http://www.timecity.org/
My work: http://flux.mentaltempt.org/~node/tc/

Reply via email to