Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » odd x errors on linux

This thread is locked; no one can reply to it. rss feed Print
odd x errors on linux
Michael Taboada
Member #14,161
March 2012

Hi,
I'm writing some games for windows mac and linux, using allegro 5.0.11 on arch linux. My desktop is the latest mate, and x is also the latest.
When my program exits, I get this error:

X Error of failed request: BadDrawable (invalid Pixmap or Window parameter)
Major opcode of failed request: 72 (X_PutImage)
Resource id in failed request: 0x2600002
Serial number of failed request: 43
Current serial number in output stream: 46

I'm not sure what this means, as all I've been able to read is that perhaps I haven't freed a display, but to the best of my knowledge I have.

If you want to look at the code causing this, look at https://github.com/2mb-solutions/bash-it.git (note: Has submodules).

-Michael.

bamccaig
Member #7,536
July 2006
avatar

I can't begin to guess what's causing this, but my understanding is that the 5.1 branch has many bug fixes and is actually considered more stable at this point despite the developers being free to make breaking changes (which doesn't seem to happen often). You can try to eliminate bugs in Allegro by building with Allegro 5.1...

I've only glanced at your code, but there are several alarm bells. You're ignoring return values[1] (which in C is your only indication of failure, which whether you think does or not, DO happen). Probably worse is the global variables. I gave up trying to spot the problem quickly because it's honestly not worth trying to weed through such poor code. Only a long session with a debugger has any hope of figuring it out, but even if you get past it now you'll just end up right back here again and again. You need to learn best practices to start and refactor the code...

Peter Hull
Member #1,136
March 2001

Sounds like an interesting project!
Is the git repository you linked to up-to-date with your latest code? The main function seems to end a bit abruptly.

#SelectExpand
1int main() 2{ 3al_init(); 4al_install_audio(); 5al_install_keyboard(); 6al_init_acodec_addon(); 7ALLEGRO_DISPLAY* disp = al_create_display(640,480); 8// Generate the main menu. 9string options[] = {"play","exit"}; 10dynamic_menu* mainMenu = create_menu(options, 2, NULL, 0); 11mainMenu->set_display(disp); 12int r = mainMenu->run_extended("", "", 1, true); 13if (r == 1) 14{ 15 16} 17}

perhaps I haven't freed a display, but to the best of my knowledge I have

I would expect to see an al_destroy_display somewhere in there but I don't. I also looked in the linked repository that implements dynamic_menu.
Pete

Michael Taboada
Member #14,161
March 2012

Hi,
I actually forgot that was the wrong repository for the error, although I'm pretty sure it will happen on this one too. The repository with this issue is https://github.com/2mb-solutions/horseshoes.git
-Michael.
EDIT I've also worked up horseshoes and bash-it (https://github.com/2mb-solutions/horseshoes https://github.com/2mb-solutions/bash-it) so they make sure to destroy everything. I can't tell why, but valgrind reports something like 1000000 blocks still allocated in my program at the end of the program, though I've definitely uninstalled all the system I opened, or at least i Think I have. I'll be posting a separate message about that in a bit.

Go to: