allegro5
allegro5 copied to clipboard
segfault on exit on Linux
This happens reliably with most examples. Exact reasons unknown.
#include <stdio.h>
#include <allegro5/allegro5.h>
#include <allegro5/allegro_font.h>
int main()
{
if(!al_init()){
printf("couldn't initialize allegro\n");
return 1;
}
ALLEGRO_DISPLAY* disp = al_create_display(640, 480);
if(!disp){
printf("couldn't initialize display\n");
return 1;
}
al_destroy_display(disp);
printf("Return\n");
return 0;
}
Command: gcc test.c -o test $(pkg-config allegro-5 allegro_font-5 allegro_image-5 allegro_primitives-5 --libs --cflags) This prints "Return" then there is a Segmentation fault.
What Linux-distro are you on? I cannot reproduce this on Debian stable, Nvidia graphics driver, nor Debian unstable, on virtualbox on the same machine, allegro from latest git in both cases. (Neither with the allegro examples, or @kris659 short code example from here).
I'm using Ubuntu on WSL (someone from discord is using wayland Ubuntu)
Ubuntu 22.04.3 LTS + AMD here + X11 here.
Yeah, I am on X11 too on both my tests, just mention it for completion (Problem seems to be both X11 and wayland though).
Spent a little time on this today. It's possible to bisect a crash like this to commit d0e57462e7db9d856056d43f24131129d1268860, but reverting it in today's Allegro does nothing (because it crashes before it gets to it for me).
One reliable way to avoid this crash for me is to call al_destroy_display
or al_uninstall_system
manually. Perhaps something in GLX isn't happy to work after main exits.
So, perhaps all we have to do is add those manual calls to the examples?