Screen freezes about 30 seconds after exiting repeat loop
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Screen freezes about 30 seconds after exiting repeat loop
Hi,
I set up a repeat loop, 'repeat until fld "temp56" is 0', with a -1 negative adjustment to the value of fld "temp56" on each repeat. It works fine, negotiating a multitude of conditions, all correctly done. Then, when all is done (the loop moved lines of data from a DG to another DG), the screen freezes - that is, the screen greys out if the user tries to continue, for around 30 seconds. To try to troubleshoot what is happening, I inserted a line 'answer "...."' after the 'end repeat' line and before the 'exit mouseup' line; this line of script was never actioned. Any ideas anyone ?
I set up a repeat loop, 'repeat until fld "temp56" is 0', with a -1 negative adjustment to the value of fld "temp56" on each repeat. It works fine, negotiating a multitude of conditions, all correctly done. Then, when all is done (the loop moved lines of data from a DG to another DG), the screen freezes - that is, the screen greys out if the user tries to continue, for around 30 seconds. To try to troubleshoot what is happening, I inserted a line 'answer "...."' after the 'end repeat' line and before the 'exit mouseup' line; this line of script was never actioned. Any ideas anyone ?
Re: Screen freezes about 30 seconds after exiting repeat loop
Personally I would insert a break point inside the loop and iterate a small number of time while watching each variable. Since this is not common behaviour it’s likely something with your code and following the code execution step by step is usually illuminating.
Alternatively, you could post your code here…
Alternatively, you could post your code here…
-
- Livecode Opensource Backer
- Posts: 10077
- Joined: Fri Feb 19, 2010 10:17 am
Re: Screen freezes about 30 seconds after exiting repeat loop
This would seem to suggest that your repeat loop is going round in circles forever.I inserted a line 'answer "...."' after the 'end repeat' line and before the 'exit mouseup' line; this line of script was never actioned.
I am extremely skilled at doing this sort of thing: forgetting to insert something into my repeat loops so they stop repeating once some condition has been satisfied.
Re: Screen freezes about 30 seconds after exiting repeat loop
CAsba.
Craig
And this happens after your code does what was intended??? This seems much different an issue than that your loop simply does not exit. Can you post the stack, or at least enough of it for us to examine?the screen freezes - that is, the screen greys out if the user tries to continue, for around 30 seconds.
Craig
Re: Screen freezes about 30 seconds after exiting repeat loop
Quite possibly the loop exit condition is not met because the subtraction of 1 per iteration is done with floating point arithmetic and the nearest the value gets to zero is only ever a very close approximation. Try making the repeat until check less than or equal to zero, not "exactly zero".
Also try adding a "wait 0 milliseconds with messages" line inside the repeat loop.
Also try adding a "wait 0 milliseconds with messages" line inside the repeat loop.
-
- VIP Livecode Opensource Backer
- Posts: 10043
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Screen freezes about 30 seconds after exiting repeat loop
Without an example stack we're just guessing. With one we can probably resolve this in minutes.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Screen freezes about 30 seconds after exiting repeat loop
What everyone said, but I am still worried about what I said, that is, the issue is spookier than simply a failure to exit a loop. That would seem like a "hang", not a greying out of the screen for half a minute.
Craig
Craig
-
- Livecode Opensource Backer
- Posts: 10077
- Joined: Fri Feb 19, 2010 10:17 am
Re: Screen freezes about 30 seconds after exiting repeat loop
I wonder if for some reason LC wasn't displaying the backdrop.
Re: Screen freezes about 30 seconds after exiting repeat loop
Thanks everyone, I'll check out the 'zero' possibility. I made a workaround having discovered that the 'hang' occurs just before the processing of the last iteration. So I finish the loop before the last iteration, Repeat until check equals one, then do the last processing outside the loop. There was just too much coding, with references to other DG's to present the code.
Once again, thank you all for your interest.
Once again, thank you all for your interest.
-
- Livecode Opensource Backer
- Posts: 10077
- Joined: Fri Feb 19, 2010 10:17 am
Re: Screen freezes about 30 seconds after exiting repeat loop
I wish I could understand your reply: but I cannot.
Re: Screen freezes about 30 seconds after exiting repeat loop
CAsba.
I am with Richmond here. Are you saying that your repeat loop can successfully exit when the index counts down to 1, but cannot exit if the loop continues to count down one more iteration to zero?
I gotta see that code.
Craig
I am with Richmond here. Are you saying that your repeat loop can successfully exit when the index counts down to 1, but cannot exit if the loop continues to count down one more iteration to zero?
I gotta see that code.
Craig