The template setup I had caused covariant CountedPtr instances to attempt to delete a pointer without full knowledge of its type.
What I said in my last commit was wrong, I just woke up, the is no way to strip type data from pointers that point at items with vtables, forgive I just woke up. What actually happened is that delete wound up needing the destructor and since they were not virtual the wron one or not all all of the required ones were called.
I adjusted the CountedPtr casts and the scripting system to take their arguemtns by reference for these calls there should be no risk of the reference being invalidated prior to the scopes end and this simplifies following the logic occuring inside the CountedPtr. I bet it helps performance too.