Common Pitfalls with C++ Destructors and How to Avoid Them