Getting an access violation while multi-threading and I don't know why

I’m having a similar issue, trying to return a value from another thread is causing the crash.