Never seen something like this, but if you are distributing an exe, then you should md5 it so you can detect any change comparing with a saved md5.
This way I've found viruses that changed parts of the code and antiviruses have cleaned them up, but leaving the exes in a different state than the original, sometimes even unrunnable.
That's a really good idea.
As it turns out, I'm embarrassed to say, the line of code reported in the trace does exist, in a virtually identical list control subclass on the same form (one overlays the other exactly). I wasn't paying attention to the name of the control in which the error occurred.
There are actually 10 columns in the array in this method.
So what actually happened is that somehow, between:
FOR m.x = 1 TO ALEN(THISFORM.oMail.aSortList,1)
and
thekey = THISFORM.oMail.aSortList(m.x,10)
somehow the length of the array got truncated.
Now, there is NO other code between those two lines, so ALEN(THISFORM.oMail.aSortList,1) would have had to return an impossible result for the next line to fail.
I have seen this on a few occasions when iterating arrays, but I remain mystified as to how it could happen.
Ken
Do you have a timer in your app? Or a bindevent() that may have stopped execution between those lines of code?
On March 1, 2017 4:33:22 PM EST, Ken Dibble krdibble@stny.rr.com wrote:
Never seen something like this, but if you are distributing an exe,
then
you should md5 it so you can detect any change comparing with a saved
md5.
This way I've found viruses that changed parts of the code and
antiviruses
have cleaned them up, but leaving the exes in a different state than
the
original, sometimes even unrunnable.
That's a really good idea.
As it turns out, I'm embarrassed to say, the line of code reported in the trace does exist, in a virtually identical list control subclass on the same form (one overlays the other exactly). I wasn't paying attention to the name of the control in which the error occurred.
There are actually 10 columns in the array in this method.
So what actually happened is that somehow, between:
FOR m.x = 1 TO ALEN(THISFORM.oMail.aSortList,1)
and
thekey = THISFORM.oMail.aSortList(m.x,10)
somehow the length of the array got truncated.
Now, there is NO other code between those two lines, so ALEN(THISFORM.oMail.aSortList,1) would have had to return an impossible result for the next line to fail.
I have seen this on a few occasions when iterating arrays, but I remain mystified as to how it could happen.
Ken
Do you have a timer in your app?
Yes, there's a timer running at the global level to monitor user activity and shut down the application if it remains idle for a long period of time. The timer code does not interact with the object directly, though it will trigger a routine that closes the window that contains the object if a shutdown proces is started. But the error did not occur within such a shutdown process.
There's no DOEVENTS in the loop I described, so I would expect that the FOR .. ENDFOR loop would complete a full iteration before being interrupted by anything ultimately triggered by the timer.
I do know that VFP sometimes only appears to "become aware" of states that have changed during a loop when execution gets to the "bottom" of the loop.
I don't think there's any code within the loop that could remove rows from the array--I'm aware that's a big no-no, but I will double check it tomorrow at work.
Or a bindevent() that may have stopped execution between those lines of code?
No, no bindevents().
Thanks.
Ken
On March 1, 2017 4:33:22 PM EST, Ken Dibble krdibble@stny.rr.com wrote:
Never seen something like this, but if you are distributing an exe,
then
you should md5 it so you can detect any change comparing with a saved
md5.
This way I've found viruses that changed parts of the code and
antiviruses
have cleaned them up, but leaving the exes in a different state than
the
original, sometimes even unrunnable.
That's a really good idea.
As it turns out, I'm embarrassed to say, the line of code reported in the trace does exist, in a virtually identical list control subclass on the same form (one overlays the other exactly). I wasn't paying attention to the name of the control in which the error occurred.
There are actually 10 columns in the array in this method.
So what actually happened is that somehow, between:
FOR m.x = 1 TO ALEN(THISFORM.oMail.aSortList,1)
and
thekey = THISFORM.oMail.aSortList(m.x,10)
somehow the length of the array got truncated.
Now, there is NO other code between those two lines, so ALEN(THISFORM.oMail.aSortList,1) would have had to return an impossible result for the next line to fail.
I have seen this on a few occasions when iterating arrays, but I remain mystified as to how it could happen.
Ken
-- Sent from my Android device with K-9 Mail. Please excuse my brevity.
[excessive quoting removed by server]