I saw this reported already, but details were sketchy.
Allegro crashes sometimes under Windows when using DirectX render in full-screen mode with non-desktop resolution. Crash seems to be related to TTF addon. Here's my reproduction code:
Allegro (or rather DirectX) will crash in call from al_load_bitmap to here:
...on call to d3d_bmp->display->device->UpdateTexture on attempt to access invalid pointer. Bot input pointers seem to be valid at the first glance, so something deeper is corrupted.
However, this will not happen, if I initialize ttf addon BEFORE creating display:
This way, it always works. However, I could find no mention of this in docs, and also this does not happen if I either:
Use OpenGL or
Use windowed mode or
Use fullscreen mode with desktop resolution (1920x1080 for me)
So I think it's a bug.
This is al_init_ttf_addon, so to me it looks like something in Freetype itself:
I suspect race condition or some other synchronization problem somewhere. If I place a unneeded call to al_flip_display before addon initialization, code stop crashing:
ALLEGRO_DISPLAY *d = al_create_display(1024, 768); al_flip_display(); al_init_image_addon(); al_init_font_addon(); al_init_ttf_addon(); ALLEGRO_BITMAP *b = al_load_bitmap( "../Data/Sprites/defence_arrows.png" al_flip_display(); );
However, adding al_rest( 10.0 ) instead of al_flip_display do not help.
I noticed that when I try to set non-desktop resolution in fullscreen mode, display creation takes a longer time. Maybe this crash has something to do with it.