Sep 16, 2012 at 7:12pm UTC
Hey everybody, i honestly have no idea what the problem could be with this one
I keep getting sigabrt. I can draw bitmaps fine but sometimes it just crashes. It just tells me
Assertion failed: (bitmap->parent == ((void *)0)), function _bitmap_drawer, file /Users/angeljbatez5/allegro/src/bitmap.c, line 208.
My drawing methods are:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
if (redraw && al_event_queue_is_empty(event_queue))
{ //Drawing methods
redraw = false ;
for (int x=0; x<7; ++x)
{
for (int y=0; y<5; ++y)
{
if (tile[x][y].type == 0)
{
al_draw_bitmap(empty, tile[x][y].x*64, tile[x][y].y*64, 0); //<- Crashes here with signal SIGABRT
}
else if (tile[x][y].type == 1)
{
al_draw_bitmap(wall, tile[x][y].x*64, tile[x][y].y*64, 0);
}
else if (tile[x][y].type == 2)
{
al_draw_bitmap(end, tile[x][y].x*64, tile[x][y].y*64, 0);
}
else if (tile[x][y].type == 3)
{
al_draw_bitmap(current, tile[x][y].x*64, tile[x][y].y*64, 0);
}
}
}
al_flip_display();
}
Im using Allegro 5 with xcode
Thanks in advance :)
Last edited on Sep 17, 2012 at 8:00pm UTC
Sep 16, 2012 at 7:39pm UTC
Check function arguments before calling al_draw_bitmap(...), most likely you have a NULL pointer, like the error message says.
Sep 16, 2012 at 9:06pm UTC
The arguments to al_draw_bitmap? The problem happens after ive draw a couple of bitmaps already
Sep 17, 2012 at 4:06pm UTC
Really need help with this guys.
The problem happens after ive already drawn the bitmap a few times so its not because its null
Sep 17, 2012 at 4:20pm UTC
Do you use a debugger?
Also, your bracketing seams to be inconsistent.
Sep 17, 2012 at 4:32pm UTC
There i tried to space it as best as i could, im on my phone right now, but my bracketing looks fine to me
And yes, i use xcodes debugger
Last edited on Sep 17, 2012 at 4:33pm UTC
Sep 19, 2012 at 3:47pm UTC
Ok so at what iteration does it explode? What is [x][y] and empty at the point of segfault?