Matthew Leverton
378static void select_best_visual(ALLEGRO_DISPLAY_XGLX *glx, 379 ALLEGRO_EXTRA_DISPLAY_SETTINGS* *eds, int eds_count, 380 bool using_fbc) 381{ 382 ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); 383 384 qsort(eds, eds_count, sizeof(*eds), _al_display_settings_sorter); 385
386 ASSERT(eds[0]);
387 388 if (!eds[0]->info) { 389 ALLEGRO_ERROR("No matching displays found.\n"); 390 glx->xvinfo = NULL; 391 return; 392 }

Using VirtualBox, the assert (added by me) is triggered. All 64 visuals are "incomplete", but it still says eds_count=64.

226 ALLEGRO_INFO("%i formats.\n", num_fbconfigs); 227 228 for (i = 0; i < num_fbconfigs; i++) { 229 ALLEGRO_DEBUG("-- \n"); 230 ALLEGRO_DEBUG("Decoding visual no. %i...\n", i); 231 eds[i] = read_fbconfig(system->gfxdisplay, fbconfig[i]); 232 if (!eds[i])
233 continue;
234#ifdef DEBUGMODE 235 display_pixel_format(eds[i]); 236#endif 237 eds[i]->score = _al_score_display_settings(eds[i], ref); 238 if (eds[i]->score == -1) { 239 continue; 240 } 241 eds[i]->index = i; 242 eds[i]->info = al_malloc(sizeof(GLXFBConfig)); 243 memcpy(eds[i]->info, &fbconfig[i], sizeof(GLXFBConfig)); 244 } 245 246 *eds_count = i; 247 ALLEGRO_INFO("%i visuals are good enough.\n", i);

Could somebody who is familiar with this clean that up? It seems very sloppy to ignore NULL values, and still consider eds_count to equal i. It appears to me that you'd get 64 NULLs which are happily passed along.

I could hack in a check to switch to the old function if everything is NULL, but that isn't very proper.

With the following config, it works:


Peter Wang

You mean like this? (not really tested)

Matthew Leverton

Cannot really tell from that patch, but does this mean it will automatically fall back to "old" if "new" fails? I don't even know what's going on in that file or what the difference is between the two, so pardon my lack of effort in trying to do any debugging.

Peter Wang

It should do (fall back) although that wasn't what I was going for. Actually I wasn't sure what your bug report was about.

Matthew Leverton

Running Ubuntu under a VM triggers the behavior of those NULL values and crash on every created display.

Using the config to skip that function "fixes" it. People complain about it from time to time (not sure under what environment), and usually Elias stops by to tell them to create an allegro5.cfg with the above settings.


The patch seems to work. I just applied it as-is, and the examples all run.

Peter Wang

I always assumed that the crash was due to a bug in the newer GLX functions, otherwise why did Milan make it a configurable option? I will apply the patch.

Don Freeman

Matt what was the host system when you ran the VM?

Matthew Leverton

OS X 10.7.

Thread #609353. Printed from