1. eugrid 1.3.4 bug (attn Phil Russell)
- Posted by marky1124 Apr 21, 2009
- 832 views
Hi,
I have found a bug that crashes eugrid v1.3.4. It can be demonstrated by running the radiobutton_demo.exw sample program that comes with eugrid. Here are the steps to demonstrate the crash:-
- Run radiobutton_demo.exw
- Press and hold the left mouse button down on the top radio button
- Press the down arrow until the line you have clicked on scrolls out of sight (you can also use a mouse wheel to do this)
- Let go of the left mouse button.
It will now crash with
C:\Documents and Settings\Administrator\My Documents\$USER\T40 Desktop\Euphoria\ eugrid134\eugrid.ew:3536 in function EGW_OnLeftMouseUp() subscript value 0 is out of bounds, reading from a sequence of length 36 ... called from C:\Documents and Settings\Administrator\My Documents\Euphoria\eugrid134\eugrid.ew:4924 in function EGW_OnGridEvent() ^^^ call-back from Windows ... called from c:\euphoria\win32lib\Include\w32dll.ew:280 in procedure w32Proc() ... called from c:\euphoria\win32lib\Include\win32lib.ew:24845 in procedure eventLoop() ... called from c:\euphoria\win32lib\Include\win32lib.ew:25073 in procedure WinMain() ... called from C:\Documents and Settings\Administrator\My Documents\Euphoria\eugrid134\radiobutton_demo.exw:113 --> See ex.err Press Enter...
I believe I have found the cause of the problem in eugrid.ew (line 3536). I think the condition needs an extra set of brackets:
-- If not a checkbox cell then notify select button up here if index > 0 and column <=0 or (column>0 and not find(GridDraw[grid][CELLS][index][EGW_CELL_TYPE], {EGW_CHECKBOX, EGW_RADIOBUTTON})) then
Should be changed to
-- If not a checkbox cell then notify select button up here -- 21/04/09 - Mwy - Fixed condition to cope with index=0 & column=1 if index > 0 and (column <=0 or (column>0 and not find(GridDraw[grid][CELLS][index][EGW_CELL_TYPE], {EGW_CHECKBOX, EGW_RADIOBUTTON}))) then
I've tested my code fix and it defintely gets rid of the crash. I can't say I understand the eugrid source well enough to be 100% sure that I've done exactly the right thing. Hopefully I've not exchanged one obvious bug for a much more subtle and devious one.
I hope Phil Russell sees this.
Best Regards,
Mark Young