When I added cout statements to my destructor, I noticed it was only called once after leaving this scope (I believe it should've been called twice). But the big problem is that the program is crashing after leaving this scope.
Im pretty new to coding and not really sure how to handle such a bug. Any advice is appreciated.
Without minimum reproducible code it is hard to locate this bug. I guess that may be some kind of soft copy in assign operator, that eventually lead to crash when program tries to delete already deleted object.
I'm fairly new to C++ myself and I've already run into the following problem. I had a destructor in a derived class that was deleting data that was already being deleted in the base class. The fix was to get rid of that part of that particular destructor. In case you haven't found this out yet, deleting the same pointer twice is bad mojo (i.e. crashtown).
One possible workaround is to zero out pointers after deleting them, as you can delete a null pointer all you like. HTH,