DataGrid Crash to Desktop Revisited
Bob Sneidar
bobsneidar at iotecdigital.com
Wed Dec 18 19:30:33 EST 2019
Hi all.
I have isolated the issue I presented some time ago, where selecting a record in a datagrid crashed Livecode to desktop. It can be reproduced easily enough.
Create a stack with a single datagrid, add 2 records. In the script of the datagrid have a selectionChanged handler like so:
on selectionChanged
put the dgHilitedIndex of me into tHilitedIndex
put the dgDataOfIndex [tHilitedIndex] of me into aDGData [1]
set the dgData of me to aDGData
end selectionChanged
This demonstrates that a datagrid's selectionChanged handler cannot set it's own dgData! Neither can any other handler in the executionContexts that selectionChanged calls, while that selectionChanged is still in the executionContexts. (That's too confusing.)
In other words, while a datagrid's selectionChanged handler is "running" nothing can change the contents of the datagrid.
I'm not sure why this is, but I think it's because the datagrid library does something internernally that triggers another selectionChanged, causing an infiinite loop, forcing the engine to bail out.
Any ideas?
Bob S
More information about the use-livecode
mailing list