 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
DeathByNukes
Joined: 25 Mar 2007 Posts: 12 Location: Mabase
|
Posted: Sun Dec 23, 2007 8:11 pm Post subject: Crash with ImageSearch? [updated] |
|
|
I've been having a crash in my script lately. I opened the ListLines window and held down F5, and it seems to be happening when it hits my ImageSearch function.
Could it be that I'm giving the ImageSearch output variables that are ByRef = "" ?
| Error Signature wrote: | AppName: autohotkey.exe AppVer: 1.0.47.5 ModName: autohotkey.exe
ModVer: 1.0.47.5 Offset: 00001666 |
Here's a memory dump I got: http://files.filefront.com/AutoHotkeydmp/;9310891;/fileinfo.html
Edit:
No, it's not the ByRef. I tried giving it normal local variables instead and the problem continues.
Last edited by DeathByNukes on Sun Dec 30, 2007 3:10 am; edited 1 time in total |
|
| Back to top |
|
 |
DeathByNukes
Joined: 25 Mar 2007 Posts: 12 Location: Mabase
|
Posted: Sun Dec 30, 2007 2:47 am Post subject: |
|
|
Well, I tried debugging AHK. Looks like something's wrong but I'm not sure what. Here's a screenshot.
I set it to log its actions in more detail, and it looks like it isn't the imagesearch after all.
Here's the function where it happens:
| Code: | GameImgSearch( Image, StartX = "", StartY = "", EndX = "", EndY = "", ByRef OutX = "", ByRef OutY = "", DefaltVar = true )
{
WinGetPos, GameX, GameY, GameW, GameH, % "ahk_id " . GameGetControl() ;%
if ( StartX = "" )
{
StartX := 0
StartY := 0
EndX := GameW
EndY := GameH
}
if ( DefaltVar )
Image := "*" . GameGetSearchVar() . " " . Image
CoordMode, Pixel, Screen
Log( "Thread " . A_ThisLabel . " - ImageSearch, FoundX, FoundY, " . GameX + StartX . ", " . GameY + StartY . ", " . GameX + EndX . ", " . GameY + EndY . ", " . Image )
ImageSearch, FoundX, FoundY, GameX + StartX, GameY + StartY, GameX + EndX, GameY + EndY, %Image%
RetVal := ErrorLevel
Log( "Thread " . A_ThisLabel . " - Completed." )
if ( RetVal )
{
Log( "Thread " . A_ThisLabel . " - OutX := """"" )
OutX := ""
Log( "Thread " . A_ThisLabel . " - OutY := """"" )
OutY := ""
}
else
{
Log( "Thread " . A_ThisLabel . " - OutX := " . (FoundX - GameX) )
OutX := FoundX - GameX
Log( "Thread " . A_ThisLabel . " - OutY := " . (FoundY - GameY) )
OutY := FoundY - GameY
}
Log( "Thread " . A_ThisLabel . " - return" )
return RetVal
} |
I am using it in the main thread and in a timer.
Here's the last part of the log:
| Quote: | Thread MainScript - ImageSearch, FoundX, FoundY, 1880, 96, 2257, 311, *0 Buttons\Check Answer.png
Thread MainScript - Completed.
Thread MainScript - OutX := 348
Thread MainScript - OutY := 152
Thread MainScript - return
Thread MainScript - ImageSearch, FoundX, FoundY, 2215, 359, 2260, 382, *0 Buttons\Skip.png
Thread MainScript - Completed.
Thread MainScript - OutX := 554
Thread MainScript - OutY := 313
Thread KillTips - ImageSearch, FoundX, FoundY, 1667, 51, 2287, 385, *0 *TransBlack Buttons\Tip.gif
Thread KillTips - Completed.
Thread KillTips - OutX := ""
Thread KillTips - OutY := ""
Thread KillTips - return
*crash* |
Note that the debugged crash and the logged one are 2 seperate runs.
Could it be that the ByRef variables are not properly local somehow and one thread is breaking another's variables?
In the debug, it looks like it's crashing while trying to dereference OutX, which has a null pointer. |
|
| Back to top |
|
 |
DeathByNukes
Joined: 25 Mar 2007 Posts: 12 Location: Mabase
|
Posted: Wed Jan 02, 2008 10:26 am Post subject: |
|
|
| Well, I had the function set itself to Critical and the random crashes have stopped. This confirms it. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10450
|
Posted: Sun Mar 02, 2008 5:04 pm Post subject: |
|
|
| DeathByNukes wrote: | Could it be that the ByRef variables are not properly local somehow and one thread is breaking another's variables?
In the debug, it looks like it's crashing while trying to dereference OutX, which has a null pointer. | I think this problem was introduced when ByRef parameters started being allowed to be optional. It will be fixed in the next release.
The specific description is: Fixed crash when a function was called concurrently with an optional ByRef parameter omitted by one thread but not omitted by the other.
Thanks for reporting this. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|