From bf25315140309964301549d77c9b44fd1e55135a Mon Sep 17 00:00:00 2001 From: esiayo <41133734+blackxfiied@users.noreply.github.com> Date: Sun, 10 Nov 2024 15:34:35 +0800 Subject: [PATCH] fix: resolve container settings not saving due to deallocation conflict --- Mythic.xcodeproj/project.pbxproj | 4 ++-- Mythic/Utilities/Wine/WineInterfaceExt.swift | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Mythic.xcodeproj/project.pbxproj b/Mythic.xcodeproj/project.pbxproj index ce1c803d..cc527ad1 100644 --- a/Mythic.xcodeproj/project.pbxproj +++ b/Mythic.xcodeproj/project.pbxproj @@ -773,7 +773,7 @@ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 3067; + CURRENT_PROJECT_VERSION = 3069; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_ASSET_PATHS = "\"Mythic/Preview Content\""; @@ -820,7 +820,7 @@ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 3067; + CURRENT_PROJECT_VERSION = 3069; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_ASSET_PATHS = "\"Mythic/Preview Content\""; diff --git a/Mythic/Utilities/Wine/WineInterfaceExt.swift b/Mythic/Utilities/Wine/WineInterfaceExt.swift index 222b765d..2eec8102 100644 --- a/Mythic/Utilities/Wine/WineInterfaceExt.swift +++ b/Mythic/Utilities/Wine/WineInterfaceExt.swift @@ -45,6 +45,7 @@ extension Wine { case desktop = #"HKCU\Control Panel\Desktop"# } + // TODO: refactor class Container: Codable, Hashable, Identifiable, Equatable { static func == (lhs: Container, rhs: Container) -> Bool { return (lhs.url == rhs.url && lhs.id == rhs.id) @@ -100,7 +101,7 @@ extension Wine { self.init(name: url.lastPathComponent, url: url, settings: defaultContainerSettings) } - deinit { saveProperties() } + // deinit { saveProperties() } // FIXME: causes conflict with didSet /// Saves the container properties to disk. func saveProperties() { @@ -113,7 +114,7 @@ extension Wine { } } - var name: String + var name: String { didSet { saveProperties() } } // MARK: futureproofing var url: URL var id: UUID var settings: ContainerSettings { didSet { saveProperties() } } // FIXME: just for certainty; mythic's still in alpha, remember?