<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Problem with display destruction order</title>
		<link>http://www.allegro.cc/forums/view/615466</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Fri, 26 Jun 2015 08:06:39 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>If I run the code below <b>without</b> the reversing I get an error:
</p><div class="source-code snippet"><div class="inner"><pre> Error of failed request:  BadValue <span class="k2">(</span>integer parameter out of range <span class="k1">for</span> operation<span class="k2">)</span>
  Major opcode of failed request:  <span class="n">159</span> <span class="k2">(</span>ATIFGLEXTENSION<span class="k2">)</span>
  Minor opcode of failed request:  <span class="n">73</span> <span class="k2">(</span><span class="k2">)</span>
  Value in failed request:  <span class="n">0x1200004</span>
  Serial number of failed request:  <span class="n">203</span>
  Current serial number in output stream:  <span class="n">205</span>
</pre></div></div><p>

Is this a bug or am I missing something?<br />System: Linux 3.13.0-54-generic #91-Ubuntu SMP Tue May 26 19:15:08 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux<br />Allegro: 5.0.10</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="p">#include &lt;iostream&gt;</span>
<span class="number">  2</span><span class="p">#include &lt;vector&gt;</span>
<span class="number">  3</span><span class="p">#include &lt;allegro5/allegro.h&gt;</span>
<span class="number">  4</span><span class="p">#include &lt;algorithm&gt;</span>
<span class="number">  5</span>
<span class="number">  6</span><span class="k1">int</span> main<span class="k2">(</span><span class="k2">)</span>
<span class="number">  7</span><span class="k2">{</span>
<span class="number">  8</span>    <span class="k1">if</span><span class="k2">(</span><span class="k3">!</span><a href="http://www.allegro.cc/manual/al_init"><span class="a">al_init</span></a><span class="k2">(</span><span class="k2">)</span><span class="k2">)</span> <span class="k2">{</span>
<span class="number">  9</span>        <a href="http://www.delorie.com/djgpp/doc/libc/libc_345.html" target="_blank">fprintf</a><span class="k2">(</span>stderr, <span class="s">"failed to initialize allegro!\n"</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 10</span>        <span class="k1">return</span> <span class="k3">-</span><span class="n">1</span><span class="k2">;</span>
<span class="number"> 11</span>    <span class="k2">}</span>
<span class="number"> 12</span>
<span class="number"> 13</span>    std::vector<span class="k3">&lt;</span><a href="http://www.allegro.cc/manual/ALLEGRO_DISPLAY"><span class="a">ALLEGRO_DISPLAY</span></a><span class="k3">*</span><span class="k3">&gt;</span> v<span class="k2">;</span>
<span class="number"> 14</span>
<span class="number"> 15</span>    <span class="k1">for</span> <span class="k2">(</span>uint i <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span> i <span class="k3">&lt;</span> <span class="n">10</span><span class="k2">;</span> <span class="k3">+</span><span class="k3">+</span>i<span class="k2">)</span>
<span class="number"> 16</span>    <span class="k2">{</span>
<span class="number"> 17</span>        v.push_back<span class="k2">(</span><a href="http://www.allegro.cc/manual/al_create_display"><span class="a">al_create_display</span></a><span class="k2">(</span><span class="n">320</span>, <span class="n">240</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 18</span>    <span class="k2">}</span>
<span class="number"> 19</span>
<span class="number"> 20</span>    std::reverse<span class="k2">(</span>v.begin<span class="k2">(</span><span class="k2">)</span>, v.end<span class="k2">(</span><span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 21</span>
<span class="number"> 22</span>    <span class="k1">for</span> <span class="k2">(</span>uint i <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span> i <span class="k3">&lt;</span> <span class="n">10</span><span class="k2">;</span> <span class="k3">+</span><span class="k3">+</span>i<span class="k2">)</span>
<span class="number"> 23</span>    <span class="k2">{</span>
<span class="number"> 24</span>        <a href="http://www.allegro.cc/manual/al_set_target_bitmap"><span class="a">al_set_target_bitmap</span></a><span class="k2">(</span>nullptr<span class="k2">)</span><span class="k2">;</span>
<span class="number"> 25</span>        <a href="http://www.allegro.cc/manual/al_destroy_display"><span class="a">al_destroy_display</span></a><span class="k2">(</span>v<span class="k2">[</span>i<span class="k2">]</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 26</span>    <span class="k2">}</span>
<span class="number"> 27</span>
<span class="number"> 28</span>    <span class="k1">return</span> <span class="n">0</span><span class="k2">;</span>
<span class="number"> 29</span><span class="k2">}</span>
</div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Vaelin)</author>
		<pubDate>Thu, 18 Jun 2015 15:42:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>That&#39;s an error with the AMD video driver, following what google says.</p><p>It&#39;s kinda weird, looking from here, there would be no strict need to reverse the order of destruction of displays...</p><p>I don&#39;t think this strictly relates to Allegro, but a fellow Linux user mught try this out on a different platform
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (pkrcel)</author>
		<pubDate>Thu, 18 Jun 2015 17:50:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I can reproduce this (also with an AMD card). The error message comes about after a call to XCloseDisplay in src/x/xystem.c:127. Not sure what the issue is just yet.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Fri, 19 Jun 2015 09:40:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m curious if it happens with any number of displays? 2? 3? 5? 10? Maybe AMD has a stupid limit to the number of display contexts open?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Fri, 19 Jun 2015 09:43:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I got it to happen with just two displays.</p><p>EDIT: I should note that, perhaps obviously, the real issue is whether or not the first display created is destroyed before any other display is destroyed. Something in the code makes the first display special, such that when it gets destroyed, it invalidates something somewhere. I don&#39;t really know where to start, however.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Fri, 19 Jun 2015 09:46:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Well then, the time being, let&#39;s document this limitation.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (beoran)</author>
		<pubDate>Fri, 19 Jun 2015 10:48:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Is this related to linux only and AMD cards only maybe? </p><p>I&#39;m sorry I can&#39;t be more helpful but I am unable to run anything Allegro related by now.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (pkrcel)</author>
		<pubDate>Fri, 19 Jun 2015 13:07:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/615466/1014096#target">SiegeLord</a> said:</div><div class="quote"><p> I don&#39;t really know where to start, however.</p></div></div><p>If what you said is the case, maybe allegro is telling it to invalidate all contexts created by the app? Or if context sharing is enabled, the first one is probably the &quot;parent&quot; context, and manages the resources, where as the rest of them are sharing the resources of the main one (though I didn&#39;t think we supported that yet).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sat, 20 Jun 2015 02:30:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I can attest that it seems to be a Linux-only bug, tried on Windows with an AMD card, no crash.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (J-Gamer)</author>
		<pubDate>Tue, 23 Jun 2015 06:06:34 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Shoudl try forcing use of the OPENGL driver thou.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (pkrcel)</author>
		<pubDate>Wed, 24 Jun 2015 02:21:30 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>There is only one driver on linux. OpenGL. Unless of course you mean he should test with forcing opengl on windows... then never mind. <img src="http://www.allegro.cc/forums/smileys/cheesy.gif" alt=";D" border="0" />.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Wed, 24 Jun 2015 02:43:41 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>What&#39;d really be useful is if someone tested this with anything but an AMD card on Linux <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" />.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Wed, 24 Jun 2015 09:01:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Lubuntu Linux<br />Nvidia GeeForce 9600GT<br />Allegro 5.1.11<br />gcc 4.8.4</p><p>The program compiles, runs and exits without any errors.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Izual)</author>
		<pubDate>Wed, 24 Jun 2015 22:39:50 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Izual, just to be sure, did you comment out the std::reverse call in that code? The code is set to work ok by default and you need to do that modification to trigger the issue (on AMD cards at least).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Thu, 25 Jun 2015 06:22:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Duh, so much for reading only the last post carefully. <img src="http://www.allegro.cc/forums/smileys/undecided.gif" alt=":-/" /></p><p>I have set-up allegro on my work notebook. It has some kind of Intel gen3 VGA.<br />Again on Lubuntu and gcc 4.8.4 and this time without the reverse. <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" /></p><p>The results are the same, compiles, runs and exits without any error.</p><p>When i get home i will try it on my Nvidia card again.</p><p>EDIT:<br />The code with removed std::reverse also works and exits without any error on my Nvidia 9600GT.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Izual)</author>
		<pubDate>Thu, 25 Jun 2015 11:50:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Awesome, thanks Izual. You&#39;re a very tedious boss in Diablo II btw.</p><p>NVidia is known to be more tolerant to garbage input, but at least this means we&#39;re not doing something so crazy that even NVidia rejects it. Since it works on Intel, however, it does seem like it might be AMD only... I&#39;m not sure how to proceed though, hah. Ideally we&#39;d find some workaround, since AMD is our #1 platform (because it&#39;s what I use on my desktop <img src="http://www.allegro.cc/forums/smileys/cool.gif" alt="8-)" />).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (SiegeLord)</author>
		<pubDate>Fri, 26 Jun 2015 08:06:39 +0000</pubDate>
	</item>
</rss>
