Destroy_bitmap() causing error

Started by
0 comments, last by WackyWormer 15 years, 2 months ago
I've got a program where I've created a SPRITESHEET class, loaded a sprite sheet, then created a 2d array of BITMAP* and broken the sprite sheet up. Now, on exiting the program, it crashes on SPRITESHEETS destructor, specifically these lines SpriteSheet::~SpriteSheet() { for( int i=0; i<16 ; i++ ) for( int j=0; j<10 ; j++ ) destroy_bitmap( m_Sprites[j] ); } It crashes on m_Sprites[0][0], but I've checked in the debugger, and m_Sprites is full of nothing but good pointers Here's the constructor for reference SpriteSheet::SpriteSheet(BITMAP* source) { m_X_OFF = 40; m_Y_OFF = 65; m_source = source; for( int i=0; i<16 ; i++ ) for( int j=0; j<10 ; j++ ) m_Sprites[j] = create_bitmap(m_X_OFF, m_Y_OFF); if ( m_Sprites[1][1] == NULL ) { allegro_message("SpriteSheet::m_Sprites failed to load!"); while (!key[KEY_ESC]) {} } for( int i=0; i<16 ; i++ ) for( int j=0; j<10 ; j++ ) blit(source, m_Sprites[j], i*m_X_OFF, i*m_Y_OFF, 0,0, m_X_OFF, m_Y_OFF); }
Advertisement
Nobody? Well here's the error its throwing...

The thread 'Win32 Thread' (0xd80) has exited with code 0 (0x0).
First-chance exception at 0x10056a87 in Survival.exe: 0xC0000005: Access violation reading location 0x00000048.
Unhandled exception at 0x10056a87 in Survival.exe: 0xC0000005: Access violation reading location 0x00000048.

Oh, nevermind... I just realized that this is the VERY end of the program... as in allegro_exit() has already been called... stupid me

This topic is closed to new replies.

Advertisement