Still can't figure out crash in d3d_shutdown
Edgar Reynaldo

Well every time my program using my library shuts down, allegro crashes when my dll is being unloaded and it crashes in d3d_shutdown on the line _al_d3d->Release(), and Release must be a macro or something because gdb doesn't know about it, but _al_d3d appears to be a valid pointer, and it is the first time the shutdown code runs is when it crashes so I don't think it's a double free causing the issue.

Backtrace :

#SelectExpand
1Breakpoint 1, d3d_shutdown () at C:\downloads\Programming\ProgrammingLibraries\Allegro\5pt1pt8\allegro\src\win\d3d_disp.cpp:2610 22610 _al_d3d->Release(); 3(gdb) p _al_d3d 4$1 = (LPDIRECT3D9) 0x1a207e0 5(gdb) p _al_d3d->Release 6There is no member named Release. 7(gdb) p _al_d3d->Release() 8Couldn't find method IDirect3D9::Release 9(gdb) next 10 11Program received signal SIGSEGV, Segmentation fault. 120x6779fc80 in d3d_shutdown () at C:\downloads\Programming\ProgrammingLibraries\Allegro\5pt1pt8\allegro\src\win\d3d_disp.cpp:2610 132610 _al_d3d->Release(); 14(gdb) bt 15#0 0x6779fc80 in d3d_shutdown () at C:\downloads\Programming\ProgrammingLibraries\Allegro\5pt1pt8\allegro\src\win\d3d_disp.cpp:2610 16#1 0x6778fe1c in win_shutdown () at C:\downloads\Programming\ProgrammingLibraries\Allegro\5pt1pt8\allegro\src\win\wsystem.c:197 17#2 0x67730049 in shutdown_system_driver () at C:\downloads\Programming\ProgrammingLibraries\Allegro\5pt1pt8\allegro\src\system.c:77 18#3 0x67724019 in _al_run_exit_funcs () at C:\downloads\Programming\ProgrammingLibraries\Allegro\5pt1pt8\allegro\src\exitfunc.c:92 19#4 0x6773038d in al_uninstall_system () at C:\downloads\Programming\ProgrammingLibraries\Allegro\5pt1pt8\allegro\src\system.c:302 20#5 0x6ab41086 in __dll_exit () from c:\ctwoplus\progcode\eagle5gui\cbbuild\bin\eagle_a5d.dll 21#6 0x6ab4110a in DllMainCRTStartup@12 () from c:\ctwoplus\progcode\eagle5gui\cbbuild\bin\eagle_a5d.dll 22#7 0x77d0ded4 in ntdll!RtlDefaultNpAcl () from C:\Windows\system32\ntdll.dll 23#8 0x77cfa959 in ntdll!RtlExtendMemoryBlockLookaside () from C:\Windows\system32\ntdll.dll 24#9 0x77cfa8db in ntdll!RtlExtendMemoryBlockLookaside () from C:\Windows\system32\ntdll.dll 25#10 0x76a13d77 in KERNEL32!ExitThread () from C:\Windows\system32\kernel32.dll 26#11 0x00000000 in ?? () 27(gdb)

What kind of debugging should I be doing to figure out the cause of this? Any tips or advice or questions are welcome.

Kris Asick

Not quite sure without seeing more code, but shutdown crashes are typically one of two things: Memory leaks, or things being uninitialized/destroyed in the wrong order.

SiegeLord

Could also be something related to threading and TLS. There's a WANT_DLL_TLS CMake switch that might be interesting to toggle.

Thread #613778. Printed from Allegro.cc