mirror of
https://github.com/go-vgo/robotgo
synced 2026-05-24 10:19:01 +00:00
update clipboard error hand Fixed #212
This commit is contained in:
parent
1aff63a651
commit
31a5c61264
1 changed files with 6 additions and 5 deletions
|
|
@ -99,6 +99,7 @@ func writeAll(text string) error {
|
|||
if h == 0 {
|
||||
return err
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if h != 0 {
|
||||
globalFree.Call(h)
|
||||
|
|
@ -116,17 +117,17 @@ func writeAll(text string) error {
|
|||
}
|
||||
|
||||
r, _, err = globalUnlock.Call(h)
|
||||
if r == 0 {
|
||||
return err
|
||||
}
|
||||
|
||||
r, _, err = setClipboardData.Call(cfUnicodetext, h)
|
||||
if r == 0 {
|
||||
if err.(syscall.Errno) != 0 {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
r, _, err = setClipboardData.Call(cfUnicodetext, h)
|
||||
if r == 0 {
|
||||
return err
|
||||
}
|
||||
|
||||
h = 0 // suppress deferred cleanup
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue