Skip to content

Commit

Permalink
Fetch after saving to make immutable copies of values
Browse files Browse the repository at this point in the history
  • Loading branch information
jklundell committed Sep 21, 2012
1 parent 91a4531 commit 96313c2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion KCMutableDictionary/KCMutableDictionary.m
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ - (NSEnumerator *)keyEnumerator
- (void)setObject:(id)anObject forKey:(id < NSCopying >)aKey
{
[self.kcDict setObject:anObject forKey:aKey];
[self _saveDict];
if ([self _saveDict])
[self _fetchDict]; // re-fetch so we end up with immutable copies of values
}

- (void)removeObjectForKey:(id)aKey
Expand Down

0 comments on commit 96313c2

Please sign in to comment.