From 160205a71931e7d7af84f4fc96aa10e6de7e7861 Mon Sep 17 00:00:00 2001 From: Xander Deng Date: Tue, 8 Oct 2019 17:36:50 +0800 Subject: [PATCH] fix: exclusive access --- LyricsX/Component/AppController.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/LyricsX/Component/AppController.swift b/LyricsX/Component/AppController.swift index f821a721..7200a2e4 100644 --- a/LyricsX/Component/AppController.swift +++ b/LyricsX/Component/AppController.swift @@ -72,6 +72,7 @@ class AppController: NSObject { ($0?.$currentTrack).map(AnyPublisher.init) ?? Just(nil).eraseToAnyPublisher() } .switchToLatest() + .receive(on: DispatchQueue.global().cx) .sink { [unowned self] track in self.currentTrackChanged(track: track) } @@ -82,6 +83,7 @@ class AppController: NSObject { ($0?.$playbackState).map(AnyPublisher.init) ?? Just(.stopped).eraseToAnyPublisher() } .switchToLatest() + .receive(on: DispatchQueue.global().cx) .sink { [unowned self] state in self.scheduleCurrentLineCheck(playbackTime: state.time) }