As I said before, I believe, you are freeing memory, that is managed somewhere else.
-
One thing to look for, do a search over all your code, do you call
deleteanywhere?
If so, it is time to remove that in change for RAII structures. -
Make sure, ownership is clear, double check that only one place is responsible for deletion.
-
Don’t delete by hand, and always when you create something, put it in a managed ponter, like ReferenceCountedPtr, ScopedPointer, OwnedArray, or if you prefer STL use std::unique_ptr.
-
Another geniuos thing: uninitialised raw pointer and calling delete to clean up…
-
Look, if you are creating objects on the heap, that don’t belong there, like Image, MemoryBlock, Font etc… (see this thread: Loading ZipFile via a MemoryBlock)
-
Whenever you take the address of a member, consider this a bad design and try to find a better solution, since you contradict the natural lifetime of the member - especially if you return that address outside of that function
Good luck!
