Skip to content
This repository was archived by the owner on Jun 3, 2021. It is now read-only.

Commit a3111ee

Browse files
wqyfavordoumafang
authored andcommitted
[iOS] Protect inner _styles, _attributes and copy them for returning values. (#2111)
1 parent e401433 commit a3111ee

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ios/sdk/WeexSDK/Sources/Model/WXComponent.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ - (NSDictionary *)styles
278278
{
279279
NSDictionary *styles;
280280
pthread_mutex_lock(&_propertyMutex);
281-
styles = _styles;
281+
styles = [_styles copy];
282282
pthread_mutex_unlock(&_propertyMutex);
283283
return styles;
284284
}
@@ -287,7 +287,7 @@ - (NSDictionary *)pseudoClassStyles
287287
{
288288
NSDictionary *pseudoClassStyles;
289289
pthread_mutex_lock(&_propertyMutex);
290-
pseudoClassStyles = _pseudoClassStyles;
290+
pseudoClassStyles = [_pseudoClassStyles copy];
291291
pthread_mutex_unlock(&_propertyMutex);
292292

293293
return pseudoClassStyles;
@@ -302,7 +302,7 @@ - (NSDictionary *)attributes
302302
{
303303
NSDictionary *attributes;
304304
pthread_mutex_lock(&_propertyMutex);
305-
attributes = _attributes;
305+
attributes = [_attributes copy];
306306
pthread_mutex_unlock(&_propertyMutex);
307307

308308
return attributes;

0 commit comments

Comments
 (0)