If I run the code below without the reversing I get an error:
Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 159 (ATIFGLEXTENSION) Minor opcode of failed request: 73 () Value in failed request: 0x1200004 Serial number of failed request: 203 Current serial number in output stream: 205
Is this a bug or am I missing something?
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
Allegro: 5.0.10
That's an error with the AMD video driver, following what google says.
It's kinda weird, looking from here, there would be no strict need to reverse the order of destruction of displays...
I don't think this strictly relates to Allegro, but a fellow Linux user mught try this out on a different platform
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.
I'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?
I got it to happen with just two displays.
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't really know where to start, however.
Well then, the time being, let's document this limitation.
Is this related to linux only and AMD cards only maybe?
I'm sorry I can't be more helpful but I am unable to run anything Allegro related by now.
I don't really know where to start, however.
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 "parent" context, and manages the resources, where as the rest of them are sharing the resources of the main one (though I didn't think we supported that yet).
I can attest that it seems to be a Linux-only bug, tried on Windows with an AMD card, no crash.
Shoudl try forcing use of the OPENGL driver thou.
There is only one driver on linux. OpenGL. Unless of course you mean he should test with forcing opengl on windows... then never mind.
.
What'd really be useful is if someone tested this with anything but an AMD card on Linux
.
Lubuntu Linux
Nvidia GeeForce 9600GT
Allegro 5.1.11
gcc 4.8.4
The program compiles, runs and exits without any errors.
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).
Duh, so much for reading only the last post carefully. 
I have set-up allegro on my work notebook. It has some kind of Intel gen3 VGA.
Again on Lubuntu and gcc 4.8.4 and this time without the reverse. 
The results are the same, compiles, runs and exits without any error.
When i get home i will try it on my Nvidia card again.
EDIT:
The code with removed std::reverse also works and exits without any error on my Nvidia 9600GT.
Awesome, thanks Izual. You're a very tedious boss in Diablo II btw.
NVidia is known to be more tolerant to garbage input, but at least this means we'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'm not sure how to proceed though, hah. Ideally we'd find some workaround, since AMD is our #1 platform (because it's what I use on my desktop
).