Open LasagnaCake opened 2 years ago
After a bit of debugging, I found that the error is caused by, within the primitives drawing functions, a call to al_get_bitmap_flags()
being passed a null
value, which is most likely caused by al_get_target_bitmap()
returning null
.
Hello,
almost same issue here. And this is because I forgot to call al_init_primitives_addon
and al_shutdown_primitives_addon
.
My crash occured at any al_draw_<shape>()
function. Whatever display/draw function I try to use after it (like al_flip_display()
, al_acknowledge_drawing_halt
, etc.) I got this exception, same as yours:
Exception thrown at 0x00007FF8745178B0 (allegro-5.2.dll) in TestBinary.exe: 0xC0000005: Access violation reading location 0x0000000000000000.
HOWEVER, if I remove my call to the al_draw_<shape>()
and try to draw something else with al_draw_text(()
, it works perfectly fine. Meaning it is something linked to the addon, and thus the missing init call :)
OS: Windows 10 Family 64 bits (10.0 - build 19045) Machine: Intel Core i7-7700HQ CPU @ 2.80Ghz (8CPUs) - 12GB of RAM Display: DirectX 12 with NVIDIA GeForce GTX 1060 Max-Q Design (DDI direct3D enabled) Allegro version: 5.2.8.1 IDE: Visual Studio Code 2022 (allegro installed with NuGet)
Allegro initialisation performed:
al_init
al_init_font_addon
al_init_ttf_addon
So if I do NOT init the addon for primitives, it gives me this:
Callstack:
allegro-5.2.dll!00007ff856c378b0() Unknown
allegro_primitives-5.2.dll!00007ff871741dfe() Unknown
allegro_primitives-5.2.dll!00007ff87174154a() Unknown
allegro_primitives-5.2.dll!00007ff871747cd1() Unknown
allegro_primitives-5.2.dll!00007ff871738d2d() Unknown
> TestBinary.exe!TEST::test() Line 169 C++
TestBinary.exe!main(const int argc, const char * * argv) Line 17 C++
Full stacktrace;
'TestBinary.exe' (Win32): Loaded 'C:\Users\hugue\source\repos\TestBinary\x64\Debug\TestBinary.exe'. Symbols loaded.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Users\hugue\source\repos\TestBinary\x64\Debug\allegro-5.2.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\user32.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\win32u.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\gdi32.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\gdi32full.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\msvcp_win.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbase.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\ole32.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\rpcrt4.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\combase.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\shlwapi.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\msvcrt.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\shell32.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Users\xxxxxxxx\source\repos\TestBinary\x64\Debug\allegro_color-5.2.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Users\xxxxxxxx\source\repos\TestBinary\x64\Debug\allegro_font-5.2.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Users\xxxxxxxx\source\repos\TestBinary\x64\Debug\allegro_ttf-5.2.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Users\xxxxxxxx\source\repos\TestBinary\x64\Debug\allegro_primitives-5.2.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\msvcp140d.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140d.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140_1d.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbased.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\winmm.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\opengl32.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\advapi32.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\sechost.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\glu32.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\imm32.dll'.
The thread 0x6420 has exited with code 0 (0x0).
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\SHCore.dll'.
'TestBinary.exe' (Win32): Unloaded 'C:\Windows\System32\SHCore.dll'
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\SHCore.dll'.
'TestBinary.exe' (Win32): Unloaded 'C:\Windows\System32\SHCore.dll'
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\SHCore.dll'.
'TestBinary.exe' (Win32): Unloaded 'C:\Windows\System32\SHCore.dll'
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\SHCore.dll'.
'TestBinary.exe' (Win32): Unloaded 'C:\Windows\System32\SHCore.dll'
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\d3d9.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\kernel.appcore.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\windows.storage.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\dwmapi.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\wldp.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\uxtheme.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\nvhmi.inf_amd64_b2524b812d9b5fc8\nvldumdx.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\version.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\msasn1.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\cryptnet.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\crypt32.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\drvstore.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\devobj.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\cfgmgr32.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\cryptbase.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\wintrust.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\imagehlp.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\cryptsp.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\rsaenh.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\bcrypt.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\bcryptprimitives.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\nvhmi.inf_amd64_b2524b812d9b5fc8\nvd3dumx.dll'.
NVD3DREL: GR-805 : DX9 Overlay is DISABLED
NVD3DREL: GR-805 : DX9 Overlay is DISABLED
NVD3DREL: GR-805 : DX9 Overlay is DISABLED
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\ResourcePolicyClient.dll'.
'TestBinary.exe' (Win32): Unloaded 'C:\Windows\System32\ResourcePolicyClient.dll'
NVD3DREL: GR-805 : DX9 Overlay is DISABLED
The thread 0x1950 has exited with code 0 (0x0).
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\msctf.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\oleaut32.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\TextInputFramework.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\CoreUIComponents.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\CoreMessaging.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\ws2_32.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\SHCore.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\ntmarta.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\WinTypes.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\WinTypes.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\WinTypes.dll'.
'TestBinary.exe' (Win32): Unloaded 'C:\Windows\System32\WinTypes.dll'
'TestBinary.exe' (Win32): Unloaded 'C:\Windows\System32\WinTypes.dll'
NVD3DREL: GR-805 : DX9 Overlay is DISABLED
NVD3DREL: GR-805 : DX9 Overlay is DISABLED
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\nvspcap64.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\profapi.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\gpapi.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\DriverStore\FileRepository\nvhmi.inf_amd64_b2524b812d9b5fc8\NvCamera\NvCameraAllowlisting64.dll'.
'TestBinary.exe' (Win32): Unloaded 'C:\Windows\System32\DriverStore\FileRepository\nvhmi.inf_amd64_b2524b812d9b5fc8\NvCamera\NvCameraAllowlisting64.dll'
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\DXCore.dll'.
'TestBinary.exe' (Win32): Loaded 'C:\Windows\System32\D3DX9_43.dll'.
Exception thrown at 0x00007FF8745178B0 (allegro-5.2.dll) in TestBinary.exe: 0xC0000005: Access violation reading location 0x0000000000000000.
So @LasagnaCake : Question : did you correctly initialize al_init_primitives_addon
?
@SiegeLordEx / @allefant : Shouldn't you add a check in all al_draw_<shape>()
to avoid a crash ? Or is this intended ?
There is a check if you compile using the debug versions of the library (e.g https://github.com/liballeg/allegro5/blob/1c7486af5333a21d53c1ea4f9f9a68bb5ed0d760/addons/primitives/primitives.c#L83).
Information
OS: Windows 10 Allegro Version: 5.2.8.0 IDE: Code::Blocks
Issue
Hello,
I have been following the Allegro 5 tutorial (github.com/liballeg/allegro_wiki/wiki/Allegro-Vivace), and I have encountered an issue with the primitives add-on. Every time I try to draw any primitive (
al_draw_<shape>()
), the program crashes and returns the aforementioned exit status.Allegro.log File
The allegro.log file generated:
allegro.log