lib: Consistently unsubscribe from config-wrapper (fixes #6133) (#6205)

This commit is contained in:
Simon Frei
2019-12-04 07:15:00 +01:00
committed by Jakob Borg
parent a9e490adfa
commit 6fd5e78740
5 changed files with 27 additions and 5 deletions

View File

@@ -217,7 +217,6 @@ func NewModel(cfg config.Wrapper, id protocol.DeviceID, clientName, clientVersio
}
m.Add(m.progressEmitter)
scanLimiter.setCapacity(cfg.Options().MaxConcurrentScans)
cfg.Subscribe(m)
return m
}
@@ -241,9 +240,11 @@ func (m *model) onServe() {
}
m.newFolder(folderCfg)
}
m.cfg.Subscribe(m)
}
func (m *model) Stop() {
m.cfg.Unsubscribe(m)
m.Supervisor.Stop()
devs := m.cfg.Devices()
ids := make([]protocol.DeviceID, 0, len(devs))