Crash in d3d_shutdown
Edgar Reynaldo

I'm trying to build a simple app with my libraries and when it closes it always crashes in d3d_shutdown. MinGW 4.5.0 Win Vista. Does anybody know why? And what was line 2620 of d3d_disp.cpp in the allegro 5.1.7 release? That's where it crashes.


c:\ctwoplus\progcode\Eagle5GUI\cbbuild\bin>gdb libtest-debug.exe
GNU gdb (GDB) 7.3
(gdb) run
Starting program: c:\ctwoplus\progcode\eagle5gui\cbbuild\bin\libtest-debug.exe
[New Thread 1948.0x874]
BFD: C:\Windows\system32\atiumdva.dll: Warning: Ignoring section flag IMAGE_SCN_MEM_NOT_PAGED in section .text
BFD: C:\Windows\system32\atiumdva.dll: Warning: Ignoring section flag IMAGE_SCN_MEM_NOT_PAGED in section .rdata
BFD: C:\Windows\system32\atiumdva.dll: Warning: Ignoring section flag IMAGE_SCN_MEM_NOT_PAGED in section .data
[New Thread 1948.0x1554]
[New Thread 1948.0x854]
[New Thread 1948.0x1478]
[New Thread 1948.0x1120]

Program received signal SIGSEGV, Segmentation fault.
0x008b03a9 in d3d_shutdown () at d:\Libraries\build\allegro\src\allegro-git\allegro-git\src\win\d3d_disp.cpp:2620
2620    d:\Libraries\build\allegro\src\allegro-git\allegro-git\src\win\d3d_disp.cpp: No such file or directory.
        in d:\Libraries\build\allegro\src\allegro-git\allegro-git\src\win\d3d_disp.cpp
(gdb) bt
#0  0x008b03a9 in d3d_shutdown () at d:\Libraries\build\allegro\src\allegro-git\allegro-git\src\win\d3d_disp.cpp:2620
#1  0x008bbdf8 in win_shutdown () at d:\Libraries\build\allegro\src\allegro-git\allegro-git\src\win\wsystem.c:197
#2  0x0084da81 in shutdown_system_driver () at d:\Libraries\build\allegro\src\allegro-git\allegro-git\src\system.c:77
#3  0x007f9449 in _al_run_exit_funcs () at d:\Libraries\build\allegro\src\allegro-git\allegro-git\src\exitfunc.c:92
#4  0x0084ddc5 in al_uninstall_system () at d:\Libraries\build\allegro\src\allegro-git\allegro-git\src\system.c:302
#5  0x6e841086 in __dll_exit () from c:\ctwoplus\progcode\eagle5gui\cbbuild\bin\eagle_a5d.dll
#6  0x6e84110a in DllMainCRTStartup@12 () from c:\ctwoplus\progcode\eagle5gui\cbbuild\bin\eagle_a5d.dll
#7  0x774cded4 in ntdll!RtlDefaultNpAcl () from C:\Windows\system32\ntdll.dll
#8  0x774ba959 in ntdll!RtlExtendMemoryBlockLookaside () from C:\Windows\system32\ntdll.dll
#9  0x774ba8db in ntdll!RtlExtendMemoryBlockLookaside () from C:\Windows\system32\ntdll.dll
#10 0x76fd3d77 in KERNEL32!ExitThread () from C:\Windows\system32\kernel32.dll
#11 0x00000000 in ?? ()
(gdb)

GullRaDriel

Since it crashed in d3d_shutdown I suppose it's coming from a double free.

That D"D function might not come from the same A5 version as yours though.

#SelectExpand
1static void d3d_shutdown(void) 2{ 3 4 _al_d3d_destroy_display_format_list(); 5 6 _al_d3d->Release(); 7 al_destroy_mutex(present_mutex); 8 al_destroy_mutex(_al_d3d_lost_device_mutex); 9 10 _al_d3d_bmp_destroy(); 11 12 FreeLibrary(_al_d3d_module); 13 _al_d3d_module = NULL; 14 15 al_free(vt); 16 vt = NULL; 17}

Edgar Reynaldo

Well, the crash comes and goes with changes in the code, but when it does crash, all I have done is call al_init and al_install functions (through my library). I tried to replicate it but cannot so far.

D3D binary incompatiblity maybe? I don't know what would cause a crash sometimes and not others.

If I can, I'll build allegro from git and see if I can reproduce it later. It will take a little while though.

Thomas Fjellstrom

If the crash changes based on you changing code, its memory corruption. make sure you're not stomping on anything.

Edgar Reynaldo

I don't have any arrays, and all I was calling was some redefined virtual functions that log and call al_init_* and al_install_*. I hadn't created any displays. I made one timer, and one queue, and that's all. I destroyed the timer and the queue. It was very simple stuff.

I think there is something else behind it but I don't know what. Haven't had any more problems so far now that the code is more complicated.

Thread #613306. Printed from Allegro.cc