From a375620cbfa9e39ad2c9a3f1a2179ee7166c1dca Mon Sep 17 00:00:00 2001 From: esiayo <41133734+blackxfiied@users.noreply.github.com> Date: Tue, 5 Nov 2024 22:58:16 +0800 Subject: [PATCH] fix: add guard statement to prevent deadlock from optional pack doublefetch in `InstallGameView` + build bump --- Mythic.xcodeproj/project.pbxproj | 4 ++-- Mythic/Views/Unified/Sheets/InstallGameView.swift | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Mythic.xcodeproj/project.pbxproj b/Mythic.xcodeproj/project.pbxproj index 0bd08aab..c6614bbe 100644 --- a/Mythic.xcodeproj/project.pbxproj +++ b/Mythic.xcodeproj/project.pbxproj @@ -760,7 +760,7 @@ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 3040; + CURRENT_PROJECT_VERSION = 3042; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_ASSET_PATHS = "\"Mythic/Preview Content\""; @@ -807,7 +807,7 @@ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 3040; + CURRENT_PROJECT_VERSION = 3042; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_ASSET_PATHS = "\"Mythic/Preview Content\""; diff --git a/Mythic/Views/Unified/Sheets/InstallGameView.swift b/Mythic/Views/Unified/Sheets/InstallGameView.swift index 3fe85966..2d084ebf 100644 --- a/Mythic/Views/Unified/Sheets/InstallGameView.swift +++ b/Mythic/Views/Unified/Sheets/InstallGameView.swift @@ -14,7 +14,7 @@ struct InstallViewEvo: View { @State var optionalPacks: [String: String] = .init() @State var selectedOptionalPacks: Set = .init() - @State var fetchingOptionalPacks: Bool = true + @State var fetchingOptionalPacks: Bool = false @State var installSize: Double? @@ -28,6 +28,7 @@ struct InstallViewEvo: View { @ObservedObject var operation: GameOperation = .shared private func fetchOptionalPacks() async { + guard !fetchingOptionalPacks else { return } withAnimation { fetchingOptionalPacks = true } try? await Legendary.command( @@ -189,7 +190,7 @@ struct InstallViewEvo: View { } if let platforms = supportedPlatforms { - platform = platforms.contains(.macOS) ? .macOS : .windows + platform = platforms.contains(.macOS) ? .macOS : (supportedPlatforms?.first ?? .windows) } if let supportedPlatforms = supportedPlatforms,