brainiac commented on merge request !2 at RG Creators / Plugins / MQ2NetBots

brainiac
2023-11-06T16:33:40Z

you want to be making copies of the shared_ptr. Its a ref-counted pointer, so each copy increments the reference count, and when a copy is destroyed, it decrements the reference count.

by storing it in the VarPtr, it gives us the ability to tie the lifetime of the BotInfo to the last thing still referencing it.

Storing a reference or avoiding copies completely negates that. Gotta keep in mind we're talking about copies of a pointer to an object, not copies of the object itself.