diff --git a/cli/main.go b/cli/main.go index 811753f..fd297f1 100644 --- a/cli/main.go +++ b/cli/main.go @@ -68,7 +68,7 @@ func welcomeScreen(a fyne.App, v vrcarjt.AutoRejoin, w fyne.Window) fyne.CanvasO widget.NewGroup("Controls", fyne.NewContainerWithLayout(layout.NewGridLayout(2), - widget.NewButton("Status: Start", func() { + widget.NewButton("Start", func() { if v.IsRun() { return } diff --git a/vrc_auto_rejoin_tool.go b/vrc_auto_rejoin_tool.go index 5e0c377..0039483 100644 --- a/vrc_auto_rejoin_tool.go +++ b/vrc_auto_rejoin_tool.go @@ -128,17 +128,19 @@ func (v *VRCAutoRejoinTool) Run() error { ok, err := lock.Try() if err != nil || !ok { + v.lock.Lock() + v.running = false + v.lock.Unlock() return ErrDuplicateRun } if err = lock.Lock(); err != nil { + v.lock.Lock() + v.running = false + v.lock.Unlock() return err } - v.lock.Lock() - v.running = true - v.lock.Unlock() - defer lock.UnLock() v.setupTimeLocation() @@ -157,6 +159,10 @@ func (v *VRCAutoRejoinTool) Run() error { return err } + v.lock.Lock() + v.running = true + v.lock.Unlock() + v.playAudioFile("start.wav") v.wait.Add(1)