Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetTitle() fails if active window is minimised on macOS and panics entire application #533

Closed
1 of 3 tasks
xtj7 opened this issue Sep 12, 2022 · 0 comments
Closed
1 of 3 tasks
Milestone

Comments

@xtj7
Copy link

xtj7 commented Sep 12, 2022

  • Robotgo version (or commit ref): 10.0-beta5.3
  • Go version: go1.19.1 darwin/arm64
  • Gcc version: Apple clang version 13.1.6 (clang-1316.0.21.2.5)
  • Operating system and bit: macOS Monterey (12.5.1) on M1 Ultra
  • Resolution: GetTitle is not throwing a panic when a window is minimised before a new window is made active
  • Can you reproduce the bug at Examples:
    • Yes (provide example code)
    • No
    • Not relevant
  • Provide example code:

Important: See steps in "description" to reproduce the error.

package main

import (
  "fmt"
  "time"
  "github.com/go-vgo/robotgo"
)

func main() {
  go printCurrentTitle()
  time.Sleep(time.Second * 15)
}

func printCurrentTitle() {
  for range time.Tick(time.Second * 1) {
    fmt.Println(robotgo.GetTitle())
  }
}
  • Log gist:
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x2 addr=0x10 pc=0x1a9d065a0]

runtime stack:
runtime.throw({0x1049d6fb0?, 0x61707020?})
        /opt/homebrew/Cellar/go/1.19.1/libexec/src/runtime/panic.go:1047 +0x40 fp=0x16ba2d480 sp=0x16ba2d450 pc=0x10474af50
runtime.sigpanic()
        /opt/homebrew/Cellar/go/1.19.1/libexec/src/runtime/signal_unix.go:819 +0x1e4 fp=0x16ba2d4b0 sp=0x16ba2d480 pc=0x1047613c4

goroutine 47 [syscall]:
runtime.cgocall(0x1049bcd70, 0x14000571db8)
        /opt/homebrew/Cellar/go/1.19.1/libexec/src/runtime/cgocall.go:158 +0x54 fp=0x14000571d80 sp=0x14000571d40 pc=0x10471a154
github.com/go-vgo/robotgo._Cfunc_get_main_title()
        _cgo_gotypes.go:626 +0x38 fp=0x14000571db0 sp=0x14000571d80 pc=0x1049b27d8
github.com/go-vgo/robotgo.GetTitle({0x0?, 0x140001b4600?, 0x14000585e38?})
        /Users/tobias/go/pkg/mod/github.com/go-vgo/robotgo@v1.0.0-beta5.3/robotgo.go:1012 +0x7c fp=0x14000571df0 sp=0x14000571db0 pc=0x1049b400c

...

Description

Run the example code, switch to another window, minimise window, wait one second, application will crash. I was not able to recover the panic either nor able to work around it.

It seems that macOS is in a weird state robotgo cannot handle if an active window gets minimised and no other window is made active before calling GetTitle()

@xtj7 xtj7 changed the title GetTitle() fails if window is minimised on macOS and panics entire application GetTitle() fails if active window is minimised on macOS and panics entire application Sep 12, 2022
@vcaesar vcaesar added this to the v1.0.0 milestone Sep 7, 2023
@vcaesar vcaesar closed this as completed Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants