Reputation: 47945
Sometimes when I quit my application (SaviHOST running a DLL that I'm making) I show this screen:
Unfortunately I don't know where the error happens, because it just load that screen, not the line where the exception is made.
How can I fix this? What wntdll.pdb have to do with this? Thanks
Upvotes: 16
Views: 52673
Reputation: 1
I was having the same problem with a non web-based application. Pulling my hair out, but it turned out to be a small logical and syntax error in the destructor of one of my classes. Here's the code as was:
// Constructor //
StatusTrigger_Manager::StatusTrigger_Manager( bool isCreator,unsigned short desiredMemberCount )
{
maxMembers = desiredMemberCount;
memberHoldersRequired = ( maxMembers / 32 ) + 1;
memberHolders = new unsigned int[ memberHoldersRequired ];
for ( unsigned short index = 0; index < memberHoldersRequired; index++ )
{
memberHolders[ index ] = 0;
}
//
if ( isCreator )
{
stringList = new STRINGLIST_STATUSTRIGGERS[ maxMembers ];
// Initialize 'stringList' members to default names
unsigned char memberName_ValueOffset = 7;
for ( unsigned int index = 0; index < maxMembers; index++ )
{
// Set current member name to default
stringList[ index ].memberName = new char[ 14 ] { "Member_00000\0" };
unsigned short individualVal = 0;
unsigned short valDivider = 10000;
unsigned int tempIndex = index;
for( unsigned char i = 0; i < 5; i++ ) {
individualVal = ( index / valDivider ) + 48;
stringList[ index ].memberName[ i + memberName_ValueOffset ] = individualVal;
tempIndex -= ( individualVal - 48 ) * valDivider;
valDivider /= 10; }
tempIndex = 0;
}
}
else
stringList = nullptr;
}
// Destructor //
StatusTrigger_Manager::~StatusTrigger_Manager()
{
if ( stringList != nullptr )
{
delete[] &stringList[ 0 ].memberName;
stringList[ 0 ].memberName = nullptr;
}
if ( memberHoldersRequired == 1 )
delete memberHolders;
else if ( memberHolders != 0 )
delete[] memberHolders;
}
And here's the destructor after making the ammendments which fixed both the dll problem and memory leak issues. Small change - but hair is now growing back.
// Destructor //
StatusTrigger_Manager::~StatusTrigger_Manager()
{
if ( stringList != nullptr )
{
for ( unsigned int index = 0; index < maxMembers; index++ )
{
delete[] stringList[ index ].memberName;
stringList[ index ].memberName = nullptr;
}
}
if ( memberHoldersRequired == 1 )
delete memberHolders;
else if ( memberHolders != 0 )
delete[] memberHolders;
}
I got clued off when the same problem wasn't occurring in debug mode - commonly caused by leaving variables unitialized which are set to defaults in debug mode only, or failure to delete an array correctly in my experience. Hope it helps. Good luck.
Upvotes: 0
Reputation: 137
Set the application to use Microsoft's symbols. rebuild and start application, it SHOULD load all symbols for you, and it might take a while depending on your internet screen, I myself am loading all the symbols now... boy it takes time!
Upvotes: 0
Reputation: 1
I had this same error, and it turned out to be me trying to delete a pointer that was not initialized with new operator in a class destructor.
example:
class smu
{
public:
smu();
~smu()
{
delete voff
}
private:
char* voff;
};
Upvotes: 0
Reputation: 51
Upvotes: 5
Reputation: 691
To see what line in your code caused it click continue and then a pop up pops, click retry.
Upvotes: 5