polylist toys
Alex Tweedly
alex at tweedly.net
Thu Aug 18 18:13:13 EDT 2022
On 18/08/2022 17:34, Steven Crighton via use-livecode wrote:
> Hi Mike,
>
> I just tested the lazy load example and hit populate and clicked around etc and could not trigger an error.
As already confirmed, that problem is fixed in 10.
However, the lazy load example still contains bugs due to race
conditions, some of which I described in some forum post somewhere (Boy
do I hate the forums! Surely there's some way to check what posts I have
done myself).
Thinking about it more, there are other race conditions which are
perhaps more obscure, but more serious. I know it's only an example, and
maybe can't be expected to be bulletproof, but as an example of how to
do Lazy Loading it is (IMHO) really too naive and simplistic. People
expect to take those examples and just use them.
The obvious race conditions are:
1. if multiple entries reference the same image, then there is a chance
the earlier ones never get properly updated (sURLToIndex[pURL] will have
been overwritten by the next call to onlineImage before the image value
gets set).
2. if the user (or anything else) resets the dataContent of the widget
while there are outstanding "load URL"s, then when the downloadComplete
is triggered, it will set the image value for some random new item to
the image of the earlier one.
3. And if the one which was wrongly set in case 2 above also happens to
be a URL that occurs multiple time (i.e. case 1 above), then that
wrongly set image will remain "forever".
Alex.
More information about the use-livecode
mailing list