Fix bug in which teardowns can be called multiple times on the same coordinator
This commit is contained in:
committed by
Stefan Ceriu
parent
bd4d3af4ee
commit
4ade260277
@@ -229,15 +229,13 @@ class NavigationSplitCoordinator: CoordinatorProtocol, ObservableObject, CustomS
|
||||
///
|
||||
/// For added complexity, the NavigationSplitCoordinator has an internal compact layout NavigationStack for which we need to manually nil things again
|
||||
private func releaseAllCoordinatorReferences() {
|
||||
sidebarModule?.tearDown()
|
||||
detailModule?.tearDown()
|
||||
sheetModule?.tearDown()
|
||||
fullScreenCoverModule?.tearDown()
|
||||
sidebarModule = nil
|
||||
detailModule = nil
|
||||
sheetModule = nil
|
||||
fullScreenCoverModule = nil
|
||||
|
||||
compactLayoutRootModule?.tearDown()
|
||||
compactLayoutStackModules.forEach { module in
|
||||
module.tearDown()
|
||||
}
|
||||
compactLayoutRootModule = nil
|
||||
compactLayoutStackModules.removeAll()
|
||||
}
|
||||
|
||||
private func logPresentationChange(_ change: String, _ module: NavigationModule) {
|
||||
@@ -626,13 +624,10 @@ class NavigationStackCoordinator: ObservableObject, CoordinatorProtocol, CustomS
|
||||
/// when a NavigationModule is dismissed. As the NavigationModule is just a wrapper multiple instances of it continuing living is of no consequence
|
||||
/// https://stackoverflow.com/questions/73885353/found-a-strange-behaviour-of-state-when-combined-to-the-new-navigation-stack/
|
||||
func stop() {
|
||||
rootModule?.tearDown()
|
||||
sheetModule?.tearDown()
|
||||
fullScreenCoverModule?.tearDown()
|
||||
|
||||
stackModules.forEach { module in
|
||||
module.tearDown()
|
||||
}
|
||||
rootModule = nil
|
||||
sheetModule = nil
|
||||
fullScreenCoverModule = nil
|
||||
stackModules.removeAll()
|
||||
}
|
||||
|
||||
// MARK: - CustomStringConvertible
|
||||
|
||||
Reference in New Issue
Block a user