Modify

Opened 11 years ago

Closed 6 years ago

#2979 closed Bug (Works For Me)

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 (2)

comment:1 by czardas, 11 years ago

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

comment:2 by J-Paul Mesnage, 6 years ago

Resolution: Works For Me
Status: newclosed

Hi,
Checking with the last release works for me

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.