<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Crash in d3d_shutdown</title>
		<link>http://www.allegro.cc/forums/view/613306</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sun, 29 Sep 2013 07:36:34 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;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&#39;s where it crashes.</p><pre>

c:\ctwoplus\progcode\Eagle5GUI\cbbuild\bin&gt;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)
</pre><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Fri, 27 Sep 2013 11:33:12 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Since it crashed in d3d_shutdown I suppose it&#39;s coming from a double free.</p><p>That D&quot;D function might not come from the same A5 version as yours though.
</p><div class="source-code"><div class="toolbar"><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number">  1</span><span class="k1">static</span> <span class="k1">void</span> d3d_shutdown<span class="k2">(</span><span class="k1">void</span><span class="k2">)</span>
<span class="number">  2</span><span class="k2">{</span>
<span class="number">  3</span>  
<span class="number">  4</span>   _al_d3d_destroy_display_format_list<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  5</span>      
<span class="number">  6</span>   _al_d3d-&gt;Release<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number">  7</span>   <a href="http://www.allegro.cc/manual/al_destroy_mutex"><span class="a">al_destroy_mutex</span></a><span class="k2">(</span>present_mutex<span class="k2">)</span><span class="k2">;</span>
<span class="number">  8</span>   <a href="http://www.allegro.cc/manual/al_destroy_mutex"><span class="a">al_destroy_mutex</span></a><span class="k2">(</span>_al_d3d_lost_device_mutex<span class="k2">)</span><span class="k2">;</span>
<span class="number">  9</span>
<span class="number"> 10</span>   _al_d3d_bmp_destroy<span class="k2">(</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 11</span>
<span class="number"> 12</span>   FreeLibrary<span class="k2">(</span>_al_d3d_module<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 13</span>   _al_d3d_module <span class="k3">=</span> NULL<span class="k2">;</span>
<span class="number"> 14</span>
<span class="number"> 15</span>   <a href="http://www.allegro.cc/manual/al_free"><span class="a">al_free</span></a><span class="k2">(</span>vt<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 16</span>   vt <span class="k3">=</span> NULL<span class="k2">;</span>
<span class="number"> 17</span><span class="k2">}</span>
</div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (GullRaDriel)</author>
		<pubDate>Fri, 27 Sep 2013 13:24:10 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>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.</p><p>D3D binary incompatiblity maybe? I don&#39;t know what would cause a crash sometimes and not others.</p><p>If I can, I&#39;ll build allegro from git and see if I can reproduce it later. It will take a little while though.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sun, 29 Sep 2013 03:07:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>If the crash changes based on you changing code, its memory corruption. make sure you&#39;re not stomping on anything.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sun, 29 Sep 2013 06:41:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I don&#39;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&#39;t created any displays. I made one timer, and one queue, and that&#39;s all. I destroyed the timer and the queue. It was very simple stuff.</p><p>I think there is something else behind it but I don&#39;t know what. Haven&#39;t had any more problems so far now that the code is more complicated.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Edgar Reynaldo)</author>
		<pubDate>Sun, 29 Sep 2013 07:36:34 +0000</pubDate>
	</item>
</rss>
