hey everyone, I am getting arror that I can't figure out. I am making a breakout clone and my error is when i exit the game. The error is
Unhandled exception at 0x56c807e5,Access violation reading location 0xfeef001a
/*
* The /GS security cookie must be initialized before any exception
* handling targetting the current image is registered. No function
* using exception handling can be called in the current image until
* after __security_init_cookie has been called.
*/
__security_init_cookie();
return __tmainCRTStartup();
}
I know it has something to do with destroying the bitmap images for my bricks because I can comment out the destroy bitmap code and no errors .
in main this is the code for generating the bricks:
for(int x = 0; x < bricksWide; x++)
{
Brick *brick = new Brick(brickImage, x * al_get_bitmap_width(brickImage), y * al_get_bitmap_height(brickImage), tint);
brickObj.push_back(brick);
}
and at the end of main this is the code for destroying the bitmaps:
for(iter = brickObj.begin(); iter != brickObj.end(); )
{
(*iter)->Destroy();
delete (*iter);
iter = brickObj.erase(iter);
}
and my Destroy() function in my Brick class is:
void Brick::Destroy()
{
if(image != NULL)
al_destroy_bitmap(image);
}