diff --git a/Parse/PFObject.m b/Parse/PFObject.m index bd8173706..b403694d0 100644 --- a/Parse/PFObject.m +++ b/Parse/PFObject.m @@ -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 @@ -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) {