It's due to the fact that this data is accessed from multiple threads. You need to lock mutex before applying any changes to the data and then unlock once you're done. Or else the program could be manipulating the data while other thread would be in the middle of writing of the same content, and unfinished content would be used, which would mean corrupted data would be used. And that causes crashes.
TUTORIAL:
You simply declare somewhere mutex variable
You want to have only one instance of this variable for locking the same data, so in this case, I used static expression in this case that will make sure we have only 1 lock instance
Then before you READ or WRITE into variables, arrays, memory in general that is being accessed throughout more than 1 thread. You need to
LOCK IT! Since CSGO is multithreaded and if you call something from 2 different hooks, it can happen that the same code would be executed at the same time, which is a problem. So you better be using mutex or some other thread-safety option to protect yourself from undefined behavior
So to lock it you just do this:
And once you're finished with READING or WRITING, you need to unlock the mutex again. So you can call it next time again. If you leave the lock LOCKED, the program will hang on the lock instruction forever, because it's waiting for another thread to unlock. So remember to UNLOCK the mutex!
To unlock the mutex you just do this: