Skip to content

Commit 5165672

Browse files
committed
Start launch asynchronus fix #1
1 parent 17313b7 commit 5165672

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

launcher/internal/gui/launchTab.go

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -119,28 +119,30 @@ func handleContainerEvent(layerProgress map[string]*widget.ProgressBar, vBox *fy
119119

120120
func launchImage(startButton *widget.Button, vBox *fyne.Container) func() {
121121
return func() {
122-
startButton.Hide()
123-
newLogSession()
124-
statusLabel.SetText("")
122+
go func() {
123+
startButton.Hide()
124+
newLogSession()
125+
statusLabel.SetText("")
125126

126-
launchAppendLog("INFO", "Starting autostart programs if configured ...")
127-
autostart.StartAll()
127+
launchAppendLog("INFO", "Starting autostart programs if configured ...")
128+
autostart.StartAll()
128129

129-
cont, err := c.NewSasmContainer()
130+
cont, err := c.NewSasmContainer()
130131

131-
if err != nil {
132-
launchAppendLog("ERROR", err.Error())
133-
tabs.SelectTabIndex(1)
134-
return
135-
}
132+
if err != nil {
133+
launchAppendLog("ERROR", err.Error())
134+
tabs.SelectTabIndex(1)
135+
return
136+
}
136137

137-
layerProgress := make(map[string]*widget.ProgressBar)
138-
cont.OnContainerEvent(handleContainerEvent(layerProgress, vBox, startButton))
139-
err = cont.Launch()
138+
layerProgress := make(map[string]*widget.ProgressBar)
139+
cont.OnContainerEvent(handleContainerEvent(layerProgress, vBox, startButton))
140+
err = cont.Launch()
140141

141-
if err != nil {
142-
launchAppendLog("ERROR", err.Error())
143-
tabs.SelectTabIndex(1)
144-
}
142+
if err != nil {
143+
launchAppendLog("ERROR", err.Error())
144+
tabs.SelectTabIndex(1)
145+
}
146+
}()
145147
}
146148
}

0 commit comments

Comments
 (0)