Make sure that an account doesn't try persist to the disk in the time that it is logically deleted and when it is actually deallocated
This commit is contained in:
parent
fec3c69f4a
commit
88b2775076
|
@ -61,6 +61,8 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
|||
return defaultName
|
||||
}()
|
||||
|
||||
public var isDeleted = false
|
||||
|
||||
public var account: Account? {
|
||||
return self
|
||||
}
|
||||
|
@ -760,19 +762,19 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
|
|||
|
||||
@objc func saveToDiskIfNeeded() {
|
||||
|
||||
if dirty {
|
||||
if dirty && !isDeleted {
|
||||
saveToDisk()
|
||||
}
|
||||
}
|
||||
|
||||
@objc func saveFeedMetadataIfNeeded() {
|
||||
if feedMetadataDirty {
|
||||
if feedMetadataDirty && !isDeleted {
|
||||
saveFeedMetadata()
|
||||
}
|
||||
}
|
||||
|
||||
@objc func saveAccountMetadataIfNeeded() {
|
||||
if metadataDirty {
|
||||
if metadataDirty && !isDeleted {
|
||||
saveAccountMetadata()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,6 +127,7 @@ public final class AccountManager: UnreadCountProvider {
|
|||
}
|
||||
|
||||
accountsDictionary.removeValue(forKey: account.accountID)
|
||||
account.isDeleted = true
|
||||
|
||||
do {
|
||||
try FileManager.default.removeItem(atPath: account.dataFolder)
|
||||
|
|
|
@ -29,7 +29,7 @@ class AddFeedWindowController : NSWindowController {
|
|||
|
||||
private var urlString: String?
|
||||
private var initialName: String?
|
||||
private var initialAccount: Account?
|
||||
private weak var initialAccount: Account?
|
||||
private var initialFolder: Folder?
|
||||
private weak var delegate: AddFeedWindowControllerDelegate?
|
||||
private var folderTreeController: TreeController!
|
||||
|
|
Loading…
Reference in New Issue