@@ -1320,9 +1320,14 @@ extension MixpanelInstance {
13201320 public func unregisterSuperProperty( _ propertyName: String ) {
13211321 trackingQueue. async { [ weak self] in
13221322 guard let self = self else { return }
1323- self . superProperties = self . trackInstance. unregisterSuperProperty ( propertyName,
1323+ let updatedSuperProperties = self . trackInstance. unregisterSuperProperty ( propertyName,
13241324 superProperties: self . superProperties)
1325- MixpanelPersistence . saveSuperProperties ( superProperties: self . superProperties, instanceName: self . name)
1325+ self . readWriteLock. write {
1326+ self . superProperties = updatedSuperProperties
1327+ }
1328+ self . readWriteLock. read {
1329+ MixpanelPersistence . saveSuperProperties ( superProperties: self . superProperties, instanceName: self . name)
1330+ }
13261331 }
13271332 }
13281333
@@ -1337,8 +1342,12 @@ extension MixpanelInstance {
13371342 var superPropertiesShadow = self . superProperties
13381343 self . trackInstance. updateSuperProperty ( update,
13391344 superProperties: & superPropertiesShadow)
1340- self . superProperties = superPropertiesShadow
1341- MixpanelPersistence . saveSuperProperties ( superProperties: self . superProperties, instanceName: self . name)
1345+ self . readWriteLock. write {
1346+ self . superProperties = superPropertiesShadow
1347+ }
1348+ self . readWriteLock. read {
1349+ MixpanelPersistence . saveSuperProperties ( superProperties: self . superProperties, instanceName: self . name)
1350+ }
13421351 }
13431352 }
13441353
0 commit comments