aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-09-04 10:03:12 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2019-09-05 22:03:21 -0600
commit55e08cbe78b4e01385237b330b5332a3c8315174 (patch)
tree7c7e62f03e3c648f7d2a596a1bfb6d011fa4a36d /ui
parentattacksurface: mention named pipe escape hatch (diff)
downloadwireguard-windows-55e08cbe78b4e01385237b330b5332a3c8315174.tar.xz
wireguard-windows-55e08cbe78b4e01385237b330b5332a3c8315174.zip
ui: do not initialize in global init()
Diffstat (limited to 'ui')
-rw-r--r--ui/managewindow.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/ui/managewindow.go b/ui/managewindow.go
index 0a4a5114..8bf6422c 100644
--- a/ui/managewindow.go
+++ b/ui/managewindow.go
@@ -6,6 +6,7 @@
package ui
import (
+ "sync"
"unsafe"
"github.com/lxn/walk"
@@ -32,13 +33,18 @@ const (
aboutWireGuardCmd = 0x37
)
-var taskbarButtonCreatedMsg = win.RegisterWindowMessage(windows.StringToUTF16Ptr("TaskbarButtonCreated"))
+var taskbarButtonCreatedMsg uint32
-func init() {
- walk.MustRegisterWindowClass(manageWindowWindowClass)
-}
+var initedManageTunnels sync.Once
func NewManageTunnelsWindow() (*ManageTunnelsWindow, error) {
+ initedManageTunnels.Do(func() {
+ walk.AppendToWalkInit(func() {
+ walk.MustRegisterWindowClass(manageWindowWindowClass)
+ taskbarButtonCreatedMsg = win.RegisterWindowMessage(windows.StringToUTF16Ptr("TaskbarButtonCreated"))
+ })
+ })
+
var err error
var disposables walk.Disposables
defer disposables.Treat()