From 988ffe0a78ebda0410e61ce31a3bd689c774f59e Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Wed, 4 Jan 2017 15:03:42 -0500 Subject: Minor fix for autocreated object repeated fields and maps. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - If setting/clearing a repeated field/map that was objects, check the class before checking the autocreator. - Just to be paranoid, don’t mutate within copy/mutableCopy for the autocreated classes to ensure there is less chance of issues if someone does something really crazy threading wise. - Some more tests for the internal AutocreatedArray/AutocreatedDictionary classes to ensure things are working as expected. - Add Xcode 8.2 to the full_mac_build.sh supported list. --- objectivec/GPBDictionary.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'objectivec/GPBDictionary.m') diff --git a/objectivec/GPBDictionary.m b/objectivec/GPBDictionary.m index fd8bd1ce..1c67c680 100644 --- a/objectivec/GPBDictionary.m +++ b/objectivec/GPBDictionary.m @@ -13579,22 +13579,26 @@ void GPBDictionaryReadEntry(id mapDictionary, - (id)copyWithZone:(NSZone *)zone { if (_dictionary == nil) { - _dictionary = [[NSMutableDictionary alloc] init]; + return [[NSMutableDictionary allocWithZone:zone] init]; } return [_dictionary copyWithZone:zone]; } - (id)mutableCopyWithZone:(NSZone *)zone { if (_dictionary == nil) { - _dictionary = [[NSMutableDictionary alloc] init]; + return [[NSMutableDictionary allocWithZone:zone] init]; } return [_dictionary mutableCopyWithZone:zone]; } +// Not really needed, but subscripting is likely common enough it doesn't hurt +// to ensure it goes directly to the real NSMutableDictionary. - (id)objectForKeyedSubscript:(id)key { return [_dictionary objectForKeyedSubscript:key]; } +// Not really needed, but subscripting is likely common enough it doesn't hurt +// to ensure it goes directly to the real NSMutableDictionary. - (void)setObject:(id)obj forKeyedSubscript:(id)key { if (_dictionary == nil) { _dictionary = [[NSMutableDictionary alloc] init]; -- cgit v1.2.3