mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-02 23:23:55 +00:00
fixed findBitmap and findPic memory leak
This commit is contained in:
parent
126392f38b
commit
ff8cd7b142
@ -858,7 +858,11 @@ func FindBitmap(bit C.MMBitmapRef, args ...interface{}) (int, int) {
|
|||||||
tolerance = 0.5
|
tolerance = 0.5
|
||||||
}
|
}
|
||||||
|
|
||||||
return internalFindBitmap(bit, sbit, tolerance)
|
fx, fy := internalFindBitmap(bit, sbit, tolerance)
|
||||||
|
FreeBitmap(bit)
|
||||||
|
FreeBitmap(sbit)
|
||||||
|
|
||||||
|
return fx, fy
|
||||||
}
|
}
|
||||||
|
|
||||||
// FindPic finding the image by path
|
// FindPic finding the image by path
|
||||||
@ -886,6 +890,8 @@ func FindPic(path string, args ...interface{}) (int, int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fx, fy := internalFindBitmap(openbit, sbit, tolerance)
|
fx, fy := internalFindBitmap(openbit, sbit, tolerance)
|
||||||
|
FreeBitmap(openbit)
|
||||||
|
FreeBitmap(sbit)
|
||||||
|
|
||||||
return fx, fy
|
return fx, fy
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user