Skip to content

Commit

Permalink
Fix race condition when deleting VM bundle
Browse files Browse the repository at this point in the history
Array should not change between check and use.
  • Loading branch information
* committed Nov 29, 2024
1 parent d534f0b commit 59c7a4d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions virtualOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 17;
CURRENT_PROJECT_VERSION = 18;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 2AD47BTDQ6;
ENABLE_HARDENED_RUNTIME = YES;
Expand Down Expand Up @@ -301,7 +301,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 17;
CURRENT_PROJECT_VERSION = 18;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 2AD47BTDQ6;
ENABLE_HARDENED_RUNTIME = YES;
Expand Down
1 change: 0 additions & 1 deletion virtualOS/Model/FileModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ struct FileModel {

func getRestoreImages() -> [String] {
var result: [String] = []

if let urls = try? FileManager.default.contentsOfDirectory(at: URL.baseURL, includingPropertiesForKeys: nil, options: []) {
for url in urls {
if url.lastPathComponent.hasSuffix("ipsw") {
Expand Down
5 changes: 3 additions & 2 deletions virtualOS/Model/TableViewDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ final class TableViewDataSource: NSObject, NSTableViewDataSource {
}

func vmBundle(forRow row: Int) -> VMBundle? {
if row < fileModel.getVMBundles().count {
return fileModel.getVMBundles()[row]
let bundles = fileModel.getVMBundles()
if row < bundles.count {
return bundles[row]
} else {
return nil
}
Expand Down

0 comments on commit 59c7a4d

Please sign in to comment.