You can call me Marius...
Now, the piece of code you posted is ok. The problem isn't there. But I guess it's just a snippet of the whole code, so we are missing something important. Unless you provide the full code, it's hard (if not impossible to spot the problem).
BTW, this is totally wrong, and definitely creates a crash...
Configuration MyConfiguration;
MyConfiguration.~Configuration();
Never do that, call the desctructor of the object. It is automatically called when the object does out of scope, or when delete is called.
What happens is that you delete conftable by calling the destructor, but you don't set it to NULL, so it's a dangling pointer, and when when the object goes out of scope and the desctructor is automatically called (a second time), it attempts to delete something that was already deleted.
Doing this removes the crash, but it's totally wrong:
Configuration::~Configuration(void) //Destructor { delete [] conftable; conftable = NULL; }
As additional reading, I recommend this article: http://www.codeguru.com/cpp/w-p/win32/tutorials/article.php/c9535/
|