Opened 8 years ago
Closed 8 years ago
#3513 closed Bug (Completed)
Crash on _Timer_KillAllTimers 3.3.14.2 x64
Reported by: | jfish | Owned by: | Jpm |
---|---|---|---|
Milestone: | 3.3.15.1 | Component: | AutoIt |
Version: | 3.3.14.0 | Severity: | None |
Keywords: | _KillAllTimers | Cc: |
Description
Please see this thread: https://www.autoitscript.com/forum/topic/185229-how-do-you-use-a-timer/?page=2#comment-1330583
It appears as though _Timer_KillAllTimers creates a crash bug in v3.3.14.2 that is not in v 3.3.12.0. The code works in the latter but the newer version creates a crash after returning "true".
Attachments (0)
Change History (11)
comment:1 Changed 8 years ago by anonymous
comment:2 Changed 8 years ago by iAmNewbe
This seems to only be an issue with the Full version of Scite 16.612.1119.0 downloaded and installed directly from https://www.autoitscript.com/site/autoit-script-editor/downloads/
I used the installer exe version.
When using the Scite version that comes in AutoIT this problem with the Kill Timers does not occur.
comment:3 follow-ups: ↓ 4 ↓ 6 Changed 8 years ago by Jpm
Hi,
it is not related with the Scite full version but when running in 64-bit
The reason that it seems to work with the Scite Lite version is that it is not running in 64-bit
Just comment the #AutoIt3Wrapper_UseX64=y line with the full Scite version and no crash will occured
comment:4 in reply to: ↑ 3 Changed 8 years ago by iAmNewbe
Replying to Jpm:
Hi,
it is not related with the Scite full version but when running in 64-bit
The reason that it seems to work with the Scite Lite version is that it is not running in 64-bit
Just comment the #AutoIt3Wrapper_UseX64=y line with the full Scite version and no crash will occured
I did that and it still crashed when using the full Scite version but not with the basic Scite version.
I had AutoIT set to default to x64 and I got the same crashing so I added the line
#AutoIt3Wrapper_UseX64=y and it crashed when set to Y and did not when set to N.
I then reinstalled AutoIT and defaulted it to x86 and no crash then when adding that line and setting it to Y the crash occurred.
Then I uninstalled the full version of Scite and set
#AutoIt3Wrapper_UseX64=y as you described and no crash occurred.
For me the only common thing that caused the crash was the Full Scite Version and the script set to x64 either by default operation at install or using that line and setting it to Y.
comment:5 Changed 8 years ago by anonymous
The Full Version of Scite was installed when crashing occurred, I reinstalled after I reinstalled AutoIT. Then I tried without the Full version and no crashing occurred no matter the #AutoIt3Wrapper_UseX64 setting.
comment:6 in reply to: ↑ 3 Changed 8 years ago by iAmNewbe
Replying to Jpm:
Hi,
it is not related with the Scite full version but when running in 64-bit
The reason that it seems to work with the Scite Lite version is that it is not running in 64-bit
Just comment the #AutoIt3Wrapper_UseX64=y line with the full Scite version and no crash will occured
I think I misunderstood your response.
Yes when using the full scite version and setting this to run in 64 bit the script crashes. When I use the basic version of scite that comes in AutoIT and I set to 64 bit there is no crashing.
Sorry for misunderstanding.
comment:7 Changed 8 years ago by Jpm
I don't understand the post above unless you want to typ 32 bit in the second occurrence.
Back to the problem you cannot use the _Timer_KillAllTimers Inside the function called when the timer fire.
#AutoIt3Wrapper_UseX64=y #include <ButtonConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <Timers.au3> #include <Debug.au3> _DebugSetup() Global $g_bExit = False Global $Form1 = GUICreate("Form1", 615, 437, 192, 124) GUISetState(@SW_SHOW) OnAutoItExitRegister("MyExitFunc") Global $myTimer = _Timer_SetTimer($Form1, 1000, "_TimedActivated") ; create timer Local $nMsg While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func MyExitFunc() Local $result = _Timer_KillAllTimers($Form1) ;~ Local $result = _Timer_KillTimer($Form1, $myTimer) _DebugReport('@@ Debug(' & @ScriptLineNumber & ') : $result = ' & $result, True) EndFunc Func _TimedActivated($hWnd, $iMsg, $iIDTimer, $iTime) #forceref $hWnd, $iMsg, $iIDTimer, $iTime Local $choice = Random(1, 3, 1) ;~ Local $choice = 3 ConsoleWrite("case " & $choice & @CRLF) Switch $choice Case 1 ;~ ConsoleWrite("case 1" & @CRLF) Case 2 ;~ ConsoleWrite("case 2" & @CRLF) Case 3 $g_bExit = True ;~ ConsoleWrite("case 3" & @CRLF) Exit EndSwitch EndFunc ;==>_TimedActivated
comment:8 Changed 8 years ago by iAmNewbe
This code works in 64 Bit when the Full Version of Scite is not installed.
The point of the timer is to run a function until a specific Switch Case is performed then turn off so the function is not called anymore.
#AutoIt3Wrapper_UseX64=y #include <ButtonConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <Timers.au3> Global $Form1 = GUICreate("Form1", 615, 437, 192, 124) GUISetState(@SW_SHOW) Global $myTimer = _Timer_SetTimer($Form1, 1000, "_TimedActivated") ; create timer Func _TimedActivated($hWnd, $iMsg, $iIDTimer, $iTime) Dim $Form1, $myTimer Local $choice = Random(1,3,1) ;ConsoleWrite($choice&@crlf) Switch $choice Case 1 ConsoleWrite("case 1"&@crlf) Case 2 ConsoleWrite("case 2"&@crlf) Case 3 _Timer_KilllTimer ($Form1, $myTimer) ; Timer needs to be shutoff or it will keep calling function ConsoleWrite("case 3"&@crlf) ; Needs to display once EndSwitch EndFunc While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _Timer_KillAllTimers ($Form1) Exit EndSwitch WEnd
comment:9 Changed 8 years ago by iAmNewbe
I get now what you are saying, _Timer_KillTimer and _Timer_KillAllTimers must be in the same scope and if need to kill a timer from a different scope such as a function to use a Toggle. That works but what I am saying is that the code I have been working with and tinkering with in that thread in the forum does work in 64 bit when Scite Full Version is NOT installed, something to look at there.
Thank you for looking into this.
comment:10 Changed 8 years ago by Jpm
True it "works" under 32-Bit but I am not sure it will work for ever.
I will update the doc to warn that the Kill timer functions must not be executed under the setTimer defined function.
comment:11 Changed 8 years ago by Jpm
- Milestone set to 3.3.15.1
- Owner set to Jpm
- Resolution set to Completed
- Status changed from new to closed
Added by revision [11816] in version: 3.3.15.1
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.
same behavior noted in _Timer_KillTimer