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

Trying to start deckmaster with no active window panics #6

Closed
rubiojr opened this issue Dec 15, 2020 · 0 comments
Closed

Trying to start deckmaster with no active window panics #6

rubiojr opened this issue Dec 15, 2020 · 0 comments
Labels
bug Something isn't working core Deckmaster foundation

Comments

@rubiojr
Copy link
Contributor

rubiojr commented Dec 15, 2020

I don't know much about xorg, but it doesn't happen once you touch the background with the mouse (making the background the first "active window" I guess?), i.e. right after a fresh start in my raspi with the default desktop:

panic: runtime error: index out of range [0] with length 0                                                                                                                                                           
                                                                                                                                                                                                                     
goroutine 1 [running]:                                                                                                                                                                                               
github.com/BurntSushi/xgb.Get32(...)                                                                                                                                                                                 
        /home/rubiojr/go/pkg/mod/github.com/!burnt!sushi/[email protected]/help.go:87                                                                                                           
main.Xorg.active(0x2062af0, 0x20803c0, 0x389, 0x21b1540, 0x21b1550, 0x21b1570, 0x21b1590, 0x0, 0x0, 0x0, ...)                                                                                                        
        /home/rubiojr/git/muesli/deckmaster/desktop_unix.go:173 +0x108                                                                                                                                               
main.Xorg.window(0x2062af0, 0x20803c0, 0x389, 0x21b1540, 0x21b1550, 0x21b1570, 0x21b1590, 0x0, 0x0, 0x0, ...)                                                                                                        
        /home/rubiojr/git/muesli/deckmaster/desktop_unix.go:219 +0x30                                                                                                                                                
main.(*Xorg).TrackWindows(0x40f708, 0x219ccc0, 0x3b9aca00, 0x0)                                                                                                                                                      
        /home/rubiojr/git/muesli/deckmaster/desktop_unix.go:92 +0x34                                                                                                                                                 
main.main()                                                                                                                                                                                                          
        /home/rubiojr/git/muesli/deckmaster/main.go:85 +0x1cc                                                                                                                                                        

This is the workaround I'm using, no idea how to correctly solve it unfortunately:

diff --git a/desktop_unix.go b/desktop_unix.go
index b30a702..b8987f1 100644
--- a/desktop_unix.go
+++ b/desktop_unix.go
@@ -170,6 +170,9 @@ func (x Xorg) active() xproto.Window {
        if err != nil {
                return x.root
        }
+       if len(p.Value) == 0 {
+               return 0
+       }
        return xproto.Window(xgb.Get32(p.Value))
 }
@muesli muesli closed this as completed in e8572a6 Feb 5, 2021
@muesli muesli added bug Something isn't working core Deckmaster foundation labels Jun 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working core Deckmaster foundation
Projects
None yet
Development

No branches or pull requests

2 participants