I'm having the following issue. I have made a GUI in Qt but it is crashing and I'm not sure of the reason. I've tried to debugged it to no success. My program creates a hash table of objects but then I try to clear it when I open another file. When I tried to debug it, the program was skipping this function and (I know it's going to sound weird, when I commented out the function call, the program seemed to try to execute the comment. This what I have. Please if this is wrong or can be improved, would you mind to post it ? Any help is really appreciated
When you first created the table, did you make sure every table[i] was NULL?
If you don't make them NULL, you'll try and delete garbage later on.
When you performed any incremental deletes, did you remember to also set the corresponding table[i] to NULL?
If you don't make them NULL, you're just double-deleting things.
The whole problem goes away if you use some kind of smart pointer, or better yet, some pre-existing container like std::vector.
DIY memory management is a PITA to fix when it inevitably goes wrong.