[v2-beta-1] Tray icon acting up with "return Pause()" Topic is solved

Report problems with documented functionality
safetycar
Posts: 435
Joined: 12 Aug 2017, 04:27

[v2-beta-1] Tray icon acting up with "return Pause()"

Post by safetycar » 13 Sep 2021, 02:22

I'll post here this possible bug that I talked about at the end of some other thread so it might have gone unnoticed (viewtopic.php?f=82&t=94515)

Expecting the tray icon to stay red but changes to green if the pause is called like "return Pause()".

With some other tries, the scripts looks to be paused because the timer stays stopped:
safetycar wrote:
07 Sep 2021, 14:06
this two scripts act the same with the timer.

But this leaves the icon green:

Code: Select all

OnError((*)=>(Pause()))
SetTimer(()=>Tooltip("Timer"), 100)
F1::Throw
And this leaves it red:

Code: Select all

OnError((*)=>(Pause(1)))
SetTimer(()=>Tooltip("Timer"), 100)
F1::Throw
Both of them keep the timer stopped. The only difference is the "1".
lexikos
Posts: 9494
Joined: 30 Sep 2013, 04:07
Contact:

Re: [v2-beta-1] Tray icon acting up with "return Pause()"  Topic is solved

Post by lexikos » 25 Sep 2021, 01:46

The tray icon is not acting up.

Pause only comes into effect when the next line is about to be executed. In v1, Pause was a command, so there was always a next line, whether it was return, Exit (even the implicit one at the end of the script) or }. In v2 that isn't the case, and Pause() can be part of a larger expression. The overall expression is generally executed before the script pauses (this isn't intended):

Code: Select all

MsgBox pause() " paused!"
If the expression calls a script function, the script may pause at the first line of that function.

With return Pause(), the thread ends before the pause comes into effect.

Because it isn't supposed to be possible for the thread to end while paused, the count of paused threads remains non-zero, and timers are not permitted to run.
safetycar
Posts: 435
Joined: 12 Aug 2017, 04:27

Re: [v2-beta-1] Tray icon acting up with "return Pause()"

Post by safetycar » 25 Sep 2021, 11:48

I appreciate the explanation. I've also seen a commit that could fix this problem and others. Thanks for paying attention to it.
Post Reply

Return to “Bug Reports”