Modify

Opened 5 years ago

Last modified 5 years ago

#2979 new Bug

AdlibUnregister failing to release timer

Reported by: czardas Owned by:
Milestone: Component: AutoIt
Version: 3.3.12.0 Severity: None
Keywords: AdlibUnregister Timer Cc:

Description

After AdlibUnregister, the original time interval is retained in memory instead of it being released. This causes a problem when you register the same function again. There should always be approximately 10 seconds between each return and new call to the function in the example below, however it goes wildly out of sync after the first run.

Global $iTimer = TimerInit(), $iSleep = 10000

AdlibRegister("AdlibTimer", $iSleep)

While 1

Sleep(20)

WEnd

Func AdlibTimer()

ConsoleWrite(TimerDiff($iTimer) & @LF) ; Time since the last visit.
AdlibUnRegister("AdlibTimer") ; This should clear everything.
Sleep($iSleep/2) ; Waste a bit of time.
AdlibRegister("AdlibTimer", $iSleep) ; The timer was not reset.
$iTimer = TimerInit() ; The time AdlibTimer was registered.

EndFunc ==

Actually SmOkE_N discovered this issue - see the following link:
http://www.autoitscript.com/forum/topic/167126-adlibregister-issue/?p=1222290

Attachments (0)

Change History (1)

comment:1 Changed 5 years ago by czardas

Reposting the code because I hit the wrong button before.

Global $iTimer = TimerInit(), $iSleep = 10000

AdlibRegister("AdlibTimer", $iSleep)

While 1
	Sleep(20)
WEnd

Func AdlibTimer()
	ConsoleWrite(TimerDiff($iTimer) & @LF) ; Time since the last visit.
	AdlibUnRegister("AdlibTimer") ; This should clear everything.
	Sleep($iSleep/2) ; Waste a bit of time.
	AdlibRegister("AdlibTimer", $iSleep) ; The timer was not reset.
	$iTimer = TimerInit() ; The time AdlibTimer was registered.
EndFunc

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as new The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.