Items added to a shared pointer are supposed to be newly allocated, and added directly into a shared pointer instance to avoid potential ref-counting issues, eg)
I’ve asked this multiple times in different places, still no answer. Is there not a single soul who knows how to make TSharedPtrs?
I’ve tried using TSharedPtr< T , ESPMode::ThreadSafe> MyPtr(&Thing), I’ve tried MakeShareable(&Thing), I simply cannot get this to work. The thing I’m pointing to isn’t a UObject, and while I had initially tried with USTRUCTs, I’m getting a crash from an empty struct.
I’m trying to make a thread-safe pointer because I need to process some big stuff on another thread, and I’ve been told that thread-safe shared pointers are the way to go. However, either the documentation is too scant, or I’m just missing something obvious. I consistently get 0xC0000005 - The thread tried to read from or write to a virtual address for which it does not have the appropriate access.
I’ve been stuck on this for a week now. I’ve asked this question here, on the forums, on the subreddit, and have gotten nothing. If nobody knows, can you at least direct me to a better place to ask? Do I email someone at Epic??
You are a saint and a champion. The crashes have stopped. I can’t believe I never caught on to that. Prior I was just trying to reference some structs I had already set up. What you’re saying though makes sense, I can see why I’d have to do it that way.