Skip to content

Commit 8cdf446

Browse files
committed
lock access to model dictionaries during encode
* Identity Model and Properties Model have access to their aliases and tags dictionary wrapped in a lock. However, this lock was missing from the encode method, and is necessary.
1 parent 35f6ed8 commit 8cdf446

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSIdentityModel.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ class OSIdentityModel: OSModel {
5757
}
5858

5959
override func encode(with coder: NSCoder) {
60-
super.encode(with: coder)
61-
coder.encode(aliases, forKey: "aliases")
60+
aliasesLock.locked {
61+
super.encode(with: coder)
62+
coder.encode(aliases, forKey: "aliases")
63+
}
6264
}
6365

6466
required init?(coder: NSCoder) {

iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSPropertiesModel.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,12 @@ class OSPropertiesModel: OSModel {
102102
}
103103

104104
override func encode(with coder: NSCoder) {
105-
super.encode(with: coder)
106-
coder.encode(language, forKey: "language")
107-
coder.encode(tags, forKey: "tags")
108-
// ... and more
105+
tagsLock.locked {
106+
super.encode(with: coder)
107+
coder.encode(language, forKey: "language")
108+
coder.encode(tags, forKey: "tags")
109+
// ... and more
110+
}
109111
}
110112

111113
required init?(coder: NSCoder) {

0 commit comments

Comments
 (0)