aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-04-29 14:25:26 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-04-29 14:25:26 +0200
commit90202fca8c9ea755d8e1d11f67e7653614ec8000 (patch)
treeca776350f662ee4ef736cf3d6c6a70bc5aa5d150
parentservice: tunnel: print stack and quit after 30 seconds of shutdown deadlock (diff)
downloadwireguard-windows-90202fca8c9ea755d8e1d11f67e7653614ec8000.tar.xz
wireguard-windows-90202fca8c9ea755d8e1d11f67e7653614ec8000.zip
ui: force tray and mtw to appear
If started too early, then these can initially fail before eventually succeeding.
-rw-r--r--ui/ui.go21
1 files changed, 15 insertions, 6 deletions
diff --git a/ui/ui.go b/ui/ui.go
index 316fbefe..56d67e65 100644
--- a/ui/ui.go
+++ b/ui/ui.go
@@ -40,14 +40,23 @@ func RunUI() {
return
}
- mtw, err := NewManageTunnelsWindow()
- if err != nil {
- panic(err)
+ var (
+ mtw *ManageTunnelsWindow
+ tray *Tray
+ )
+
+ for mtw == nil {
+ mtw, err = NewManageTunnelsWindow()
+ if err != nil {
+ time.Sleep(time.Millisecond * 400)
+ }
}
- tray, err := NewTray(mtw)
- if err != nil {
- panic(err)
+ for tray == nil {
+ tray, err = NewTray(mtw)
+ if err != nil {
+ time.Sleep(time.Millisecond * 400)
+ }
}
go func() {