robotgo
robotgo copied to clipboard
GetPixelColor panic runtime: unknown pc 0x692561 when switch rdp
- Robotgo version (or commit ref): v0.93.1
- Go version: go version go1.13.4 windows/amd64
- Gcc version: gcc version 8.1.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project)
- Operating system and bit: Windows10 1909(18363.476)
- Resolution:
- Can you reproduce the bug at Examples:
- [ ] Yes (provide example code)
- [x] No
- [ ] Not relevant
- Provide example code:
func checkPoint(rect *win.RECT, x, y int, color string) bool {
pointColor := robotgo.GetPixelColor(int(rect.Left)+x, int(rect.Top)+y)
log.Printf("checkPoint X: %v Y:%v check: %v color: %v", x, y, color, pointColor)
return strings.Contains(pointColor, color)
}
- Log gist:
Description
program run on remote desktop when switch to remote window program will panic
Exception 0xc0000005 0x0 0x8 0x692561
PC=0x692561
runtime: unknown pc 0x692561
stack: frame={sp:0x3a6fdd0, fp:0x0} stack=[0x0,0x3a6feb0)
0000000003a6fcd0: 0000000000000000 0000000000000000
0000000003a6fce0: 000005c0fffffb30 000004d0fffffb30
0000000003a6fcf0: 00000000000000f0 0000000000000000
0000000003a6fd00: 00000000c0000005 0000000000000000
0000000003a6fd10: 0000000000692561 0000000000000002
0000000003a6fd20: 0000000000000000 0000000000000008
0000000003a6fd30: 0000000000000000 0000000000000000
0000000003a6fd40: 0000000000000000 0000000000000000
0000000003a6fd50: 0000000000000000 0000000000000000
0000000003a6fd60: 0000000000000000 0000000000000000
0000000003a6fd70: 0000000000000000 0000000000000000
0000000003a6fd80: 0000000000000000 0000000000000000
0000000003a6fd90: 0000000000000000 0000027700000000
0000000003a6fda0: 0000000000692561 ffffffffffffffff
0000000003a6fdb0: 0000000000000002 0000000003a6fdd0
0000000003a6fdc0: 0000000000000033 0000000000692561
0000000003a6fdd0: <000000000040bda0 <runtime.notewakeup+96> 000000c00003ea80
0000000003a6fde0: 00000000006ce0c8 0000000003a6fe10
0000000003a6fdf0: 0000027700000339 0000000100000001
0000000003a6fe00: 000000c000047e38 000000c000052000
0000000003a6fe10: 000000c000048000 000000000069888c
0000000003a6fe20: 000000c000052780 000000c000052701
0000000003a6fe30: 000000c000052701 0001000003a6fe01
0000000003a6fe40: 000000c000047e38 000000c000052000
0000000003a6fe50: 000000c000047e38 000000000045c113 <runtime.asmcgocall+115>
0000000003a6fe60: 0000000003a6fe90 00000000004398f2 <runtime.park_m+178>
0000000003a6fe70: 000000c000034f00 00000000009d1840
0000000003a6fe80: 0000000000000001 0000000000000238
0000000003a6fe90: 000000c000052780 000000000045a83e <runtime.mcall+94>
0000000003a6fea0: 000000c000034f00 0000000001575ad0
runtime: unknown pc 0x692561
stack: frame={sp:0x3a6fdd0, fp:0x0} stack=[0x0,0x3a6feb0)
0000000003a6fcd0: 0000000000000000 0000000000000000
0000000003a6fce0: 000005c0fffffb30 000004d0fffffb30
0000000003a6fcf0: 00000000000000f0 0000000000000000
0000000003a6fd00: 00000000c0000005 0000000000000000
0000000003a6fd10: 0000000000692561 0000000000000002
0000000003a6fd20: 0000000000000000 0000000000000008
0000000003a6fd30: 0000000000000000 0000000000000000
0000000003a6fd40: 0000000000000000 0000000000000000
0000000003a6fd50: 0000000000000000 0000000000000000
0000000003a6fd60: 0000000000000000 0000000000000000
0000000003a6fd70: 0000000000000000 0000000000000000
0000000003a6fd80: 0000000000000000 0000000000000000
0000000003a6fd90: 0000000000000000 0000027700000000
0000000003a6fda0: 0000000000692561 ffffffffffffffff
0000000003a6fdb0: 0000000000000002 0000000003a6fdd0
0000000003a6fdc0: 0000000000000033 0000000000692561
0000000003a6fdd0: <000000000040bda0 <runtime.notewakeup+96> 000000c00003ea80
0000000003a6fde0: 00000000006ce0c8 0000000003a6fe10
0000000003a6fdf0: 0000027700000339 0000000100000001
0000000003a6fe00: 000000c000047e38 000000c000052000
0000000003a6fe10: 000000c000048000 000000000069888c
0000000003a6fe20: 000000c000052780 000000c000052701
0000000003a6fe30: 000000c000052701 0001000003a6fe01
0000000003a6fe40: 000000c000047e38 000000c000052000
0000000003a6fe50: 000000c000047e38 000000000045c113 <runtime.asmcgocall+115>
0000000003a6fe60: 0000000003a6fe90 00000000004398f2 <runtime.park_m+178>
0000000003a6fe70: 000000c000034f00 00000000009d1840
0000000003a6fe80: 0000000000000001 0000000000000238
0000000003a6fe90: 000000c000052780 000000000045a83e <runtime.mcall+94>
0000000003a6fea0: 000000c000034f00 0000000001575ad0
goroutine 20 [syscall]:
github.com/go-vgo/robotgo._Cfunc_get_pixel_color(0x27700000339, 0x0)
_cgo_gotypes.go:668 +0x55
github.com/go-vgo/robotgo.GetPixelColor(0x339, 0x277, 0x1, 0x0)
C:/Users/MiaoWoo/go/pkg/mod/github.com/go-vgo/[email protected]/robotgo.go
:199 +0x3a
I have the same problem when using robotgo.FindBitmap(bitmap, nil, 0.1)
but robotgo.FindBitmap(bitmap)
can work normally
I know where my problem is !
When I use robotgo.FindBitmap(bitmap, nil, 0.1)
,my app will crash after few minutes.
https://github.com/go-vgo/robotgo/blob/master/robotgo.go#L980
I found if the arg is not zero,the sbit will not FreeBitmap().
So I add a condition to it.
In robotgo.go
Before
if len(args) <= 0 {
FreeBitmap(sbit)
}
After
if len(args) <= 0 {
FreeBitmap(sbit)
} else if len(args) > 0 && args[0] == nil {
FreeBitmap(sbit)
}
And the crash never happen again.
@nk9200014 Thx, and I fixed this.