From ed2af8e0b93430796320188d431627b3486282d8 Mon Sep 17 00:00:00 2001 From: wqyfavor Date: Mon, 11 Feb 2019 14:56:54 +0800 Subject: [PATCH] [iOS] Protect inner _styles, _attributes and copy them for returning values. --- ios/sdk/WeexSDK/Sources/Model/WXComponent.mm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ios/sdk/WeexSDK/Sources/Model/WXComponent.mm b/ios/sdk/WeexSDK/Sources/Model/WXComponent.mm index 46bed10b29..4f97ffcfb1 100644 --- a/ios/sdk/WeexSDK/Sources/Model/WXComponent.mm +++ b/ios/sdk/WeexSDK/Sources/Model/WXComponent.mm @@ -278,7 +278,7 @@ - (NSDictionary *)styles { NSDictionary *styles; pthread_mutex_lock(&_propertyMutex); - styles = _styles; + styles = [_styles copy]; pthread_mutex_unlock(&_propertyMutex); return styles; } @@ -287,7 +287,7 @@ - (NSDictionary *)pseudoClassStyles { NSDictionary *pseudoClassStyles; pthread_mutex_lock(&_propertyMutex); - pseudoClassStyles = _pseudoClassStyles; + pseudoClassStyles = [_pseudoClassStyles copy]; pthread_mutex_unlock(&_propertyMutex); return pseudoClassStyles; @@ -302,7 +302,7 @@ - (NSDictionary *)attributes { NSDictionary *attributes; pthread_mutex_lock(&_propertyMutex); - attributes = _attributes; + attributes = [_attributes copy]; pthread_mutex_unlock(&_propertyMutex); return attributes;