snowplow / snowplow-unity-tracker

Snowplow event tracker for Unity. Add analytics to your Unity games and apps
http://snowplowanalytics.com
Apache License 2.0
16 stars 11 forks source link

Copy list of context entities when adding session to prevent modifying users reference #60

Closed matus-tomlein closed 1 year ago

matus-tomlein commented 1 year ago

Currently when the user adds a list of context entities using SetCustomContext(list), the tracker uses that list and later modifies it to add additional context entities to it. In case the user is reusing that list of entities for multiple tracked events, this will result in a growing list as the same instance will be modified.

We should make a copy of the list instance when SetCustomContext() is called.