Skip to content
This repository has been archived by the owner on Sep 8, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1 from freshbooks/race-condition-fix
Browse files Browse the repository at this point in the history
Race condition fix
  • Loading branch information
Smitters authored Mar 13, 2018
2 parents 5ea1dd4 + 96d20cf commit 061f226
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion RBQFetchedResultsController.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "RBQFetchedResultsController"
s.version = "5.0.3"
s.version = "5.0.4"
s.summary = "Drop-in replacement for NSFetchedResultsController backed by Realm."
s.description = <<-DESC
The RBQFetchedResultsController (FRC) is a replacement for NSFetchedResultsController when used in conjunction with RBQRealmNotificationManager and RBQRealmChangeLogger. The controller and delegate follow the same paradigm as NSFetchedResultsController, and allow the developer to monitor changes of an RLMObject subclass.
Expand Down
11 changes: 11 additions & 0 deletions RBQFetchedResultsController/Source/RBQFetchedResultsController.m
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,18 @@ - (void)calculateChangesWithAddedSafeObjects:(NSSet *)addedSafeObjects

[self runOnMainThread:^(){
[weakSelf.delegate controllerWillChangeContent:weakSelf];
if (useSem) {
dispatch_semaphore_signal(sem);
}
}];

// Wait for notifying that controller has started change its content.
// NSInternalInconsistencyException was throws when beginUpdates was called after changes on observed fetchedObjects.
// See https://freshbooks.atlassian.net/browse/HEL-12
// Added by Smetankin Dmitry
if (useSem) {
dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
}
}

[state.cacheRealm beginWriteTransaction];
Expand Down
2 changes: 1 addition & 1 deletion SwiftFetchedResultsController.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "SwiftFetchedResultsController"
s.version = "5.0.3"
s.version = "5.0.4"
s.summary = "Swift drop-in replacement for NSFetchedResultsController backed by Realm"
s.description = <<-DESC
The FetchedResultsController (FRC) is a Swift replacement for NSFetchedResultsController when used in conjunction with the ChangeLogger class. The controller and delegate follow the same paradigm as NSFetchedResultsController, and allow the developer to monitor changes of a Realm Swift Object subclass.
Expand Down

0 comments on commit 061f226

Please sign in to comment.