Skip to content

Commit

Permalink
deadlock protection
Browse files Browse the repository at this point in the history
  • Loading branch information
marinofaggiana committed Dec 18, 2024
1 parent 0a92c36 commit 5f704fa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Nextcloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5503,7 +5503,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = NKUJUXUJ3B;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand Down Expand Up @@ -5569,7 +5569,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = NKUJUXUJ3B;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand Down
8 changes: 6 additions & 2 deletions iOSClient/Files/NCFiles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,14 @@ class NCFiles: NCCollectionViewCommon {
// MARK: - DataSource

override func reloadDataSource() {
guard !isSearchingMode else {
guard !isSearchingMode
else {
return super.reloadDataSource()
}
self.semaphoreReloadDataSource.wait()

if self.semaphoreReloadDataSource.wait(timeout: .now() + 5) == .timedOut {
self.semaphoreReloadDataSource.signal()
}

var predicate = self.defaultPredicate
let predicateDirectory = NSPredicate(format: "account == %@ AND serverUrl == %@", session.account, self.serverUrl)
Expand Down
9 changes: 7 additions & 2 deletions iOSClient/Media/NCMedia.swift
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,14 @@ class NCMedia: UIViewController {

@objc func deleteFile(_ notification: NSNotification) {
guard let userInfo = notification.userInfo as NSDictionary?,
let error = userInfo["error"] as? NKError else { return }
let error = userInfo["error"] as? NKError
else {
return
}

semaphoreNotificationCenter.wait()
if self.semaphoreNotificationCenter.wait(timeout: .now() + 5) == .timedOut {
self.semaphoreNotificationCenter.signal()
}

if error.errorCode == self.global.errorResourceNotFound,
let ocId = userInfo["ocId"] as? String {
Expand Down

0 comments on commit 5f704fa

Please sign in to comment.