Make desktop.Start run on main thread (#2475)

This commit is contained in:
WithoutPants
2022-04-05 14:58:08 +10:00
committed by GitHub
parent 61d9f57ce9
commit 230d8f6028
4 changed files with 20 additions and 12 deletions

View File

@@ -255,7 +255,6 @@ func (s *singleton) PostInit(ctx context.Context) error {
s.ScraperCache = instance.initScraperCache()
writeStashIcon()
go desktop.Start(instance, &FaviconProvider{uiBox: ui.UIBox})
// clear the downloads and tmp directories
// #1021 - only clear these directories if the generated folder is non-empty
@@ -289,7 +288,7 @@ func (s *singleton) PostInit(ctx context.Context) error {
func writeStashIcon() {
p := FaviconProvider{
uiBox: ui.UIBox,
UIBox: ui.UIBox,
}
iconPath := filepath.Join(instance.Config.GetConfigPath(), "icon.png")
@@ -484,6 +483,9 @@ func (s *singleton) GetSystemStatus() *models.SystemStatus {
// Shutdown gracefully stops the manager
func (s *singleton) Shutdown(code int) {
// stop any profiling at exit
pprof.StopCPUProfile()
// TODO: Each part of the manager needs to gracefully stop at some point
// for now, we just close the database.
err := database.Close()
@@ -493,5 +495,6 @@ func (s *singleton) Shutdown(code int) {
os.Exit(1)
}
}
os.Exit(code)
}