Skip to content

Fixed deadlock in -collectDirtyChildren: #306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 23, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions Parse/PFObject.m
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ + (void)collectDirtyChildren:(id)node

} else if ([node isKindOfClass:[PFObject class]]) {
PFObject *object = (PFObject *)node;
NSDictionary *toSearch = nil;

@synchronized ([object lock]) {
// Check for cycles of new objects. Any such cycle means it will be
Expand All @@ -288,18 +289,19 @@ + (void)collectDirtyChildren:(id)node
// Recurse into this object's children looking for dirty children.
// We only need to look at the child object's current estimated data,
// because that's the only data that might need to be saved now.
[self collectDirtyChildren:object->_estimatedData.dictionaryRepresentation
children:dirtyChildren
files:dirtyFiles
seen:seen
seenNew:seenNew
currentUser:currentUser];

if ([object isDirty:NO]) {
[dirtyChildren addObject:object];
}
toSearch = [object->_estimatedData.dictionaryRepresentation copy];
}

[self collectDirtyChildren:toSearch
children:dirtyChildren
files:dirtyFiles
seen:seen
seenNew:seenNew
currentUser:currentUser];

if ([object isDirty:NO]) {
[dirtyChildren addObject:object];
}
} else if ([node isKindOfClass:[PFFile class]]) {
PFFile *file = (PFFile *)node;
if (!file.url) {
Expand Down