Skip to content

Commit

Permalink
fix: hide form cancel button to prevent crash when clicking before st…
Browse files Browse the repository at this point in the history
…arting server
  • Loading branch information
chabad360 committed Nov 5, 2021
1 parent b7cbba1 commit 9069419
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,7 @@ func gui() {
CancelText: "Stop Server",
}

form.OnCancel = func() {
infoLabel.Text = "Stopping Server"
serverStop()
infoLabel.Text = "Server Stopped"
form.SubmitText = "Start Server"
oscOutput.Enable()
oscInput.Enable()
oscAddr.Enable()
httpPortField.Enable()
form.Refresh()
runtime.GC()
}
form.OnCancel = nil
form.OnSubmit = func() {
clipPath = path.Text
OSCOutPort = oscOutput.Text
Expand All @@ -94,6 +83,23 @@ func gui() {
oscInput.Disable()
oscAddr.Disable()
httpPortField.Disable()

form.OnCancel = func() {
infoLabel.Text = "Stopping Server"
serverStop()
infoLabel.Text = "Server Stopped"
form.SubmitText = "Start Server"
oscOutput.Enable()
oscInput.Enable()
oscAddr.Enable()
httpPortField.Enable()

form.OnCancel = nil

form.Refresh()
runtime.GC()
}

form.Refresh()
runtime.GC()
}
Expand Down

0 comments on commit 9069419

Please sign in to comment.