Memory Allocation

Bob Sneidar bobsneidar at iotecdigital.com
Wed Feb 8 19:16:43 EST 2017


OK I've figured this out. I'm not sure if this qualifies as a bug per se, but you cannot modify the datagrid data while a selectionChanged handler is running. The only reason I can think this is an issue is if the datagrid library calls selectionChanged itself. The workaround is to send in time to a handler that changes the dgData or dgDataOfRecord/Index. Not sure what would happen with dgText.

ex.
on selectionChanged
  put "12345" into aDGData [1] ["some column"]
  set the dgData of me to aDGData
  set the dgHilitedIndex of me to 1
end selectionChanged

BAAAAD

on selectionChanged
  send populateMe to me in 10 milliseconds
selectionChanged

on populateMe
  put "12345" into aDGData [1] ["some column"]
  set the dgData of me to aDGData
  set the dgHilitedIndex of me to 1
end populateMe

GOOOOD

The odd thing is I tested this in a simple stack with a datagrid with one column without fail. It may be I need more data to get it to glitch, but I can definitely make it happen every time in a more complex app, and I can also definitely make it not fail using send in time.

If anyone at Livecode wants to remote in to my workstation sometime so I can demonstrate the issue I'm open to that. The app is way to big to even attempt to send via the QC center. Contact me off list.

Bob S



On Feb 8, 2017, at 14:36 , Bob Sneidar <bobsneidar at iotecdigital.com<mailto:bobsneidar at iotecdigital.com>> wrote:

NVM I am discovering that setting the DGData of a datagrid in the middle of a selectionChanged handler is what is crashing to desktop. I can produce this every single time in my app, but alas when I rey to create a test stack I cannot reproduce it.

But I enabled gRevDevelopment and I discovered where it's going wrong. There is a private command called _resetdata that when called in this manner crashes to desktop. I will investigate further to see what command specifically is doing it.

BTW it is not the data itself. I put empty into the array, then set a single line and a single column to the value "12345". Still crashes.

Bob S




More information about the Use-livecode mailing list