Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » Allegro 5.0.0rc1 released!

This thread is locked; no one can reply to it. rss feed Print
Allegro 5.0.0rc1 released!
Peter Wang
Member #23
April 2000

Those are "object-oriented" and have some place to stash the string buffer. The only such place for al_get_current_directory() is in a global variable, which introduces problems with threads. Then we would need to make it thread-local, which introduces its own issues.

Just make a function that copies the string to your preferred location, and free Allegro's string immediately. You can make assumptions in your application that Allegro can't.

Aaron Bolyard
Member #7,537
July 2006
avatar

I was just fiddling around with this version of Allegro and I found a problem. Probably on my end, but the behavior is still strange regardless.

I have this simple program:

#SelectExpand
1int main(void) 2{ 3 ALLEGRO_DISPLAY * display; 4 5 if (!al_init()) 6 return 1; 7 8 al_set_new_display_flags(ALLEGRO_FULLSCREEN_WINDOW & ALLEGRO_OPENGL); 9 al_set_new_display_option(ALLEGRO_STENCIL_SIZE, 1, ALLEGRO_REQUIRE); 10 11 display = al_create_display(640, 480); 12 13 if (!display) 14 return 1; 15 16 al_destroy_display(display); 17 18 return 0; 19}

Running it endlessly tries to create windows until the program crashes. I attached the log and am using the RC1 release from Allegro5.org. I figured al_create_display would fail gracefully instead of getting stuck in an endless loop.

Thomas Fjellstrom
Member #476
June 2000
avatar

That problem seems to happen on some computers.. It should be known that there is no loop in the display creation code AFAIK. So whatever is happening is a driver or d3d bug.

So far we have no idea what causes it.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Peter Wang
Member #23
April 2000

Adding some logging in the loop around d3d_disp.cpp:1809 should help to debug it.

Elias
Member #358
May 2000

Well, the attached log does suggest some kind of loop. I added a bug report for it so we won't forget before the final 5.0, but hopefully we'll be able to fix it right away.

--
"Either help out or stop whining" - Evert

David Capello
Member #708
October 2000

Is it related to D3D or to OpenGL? (see the ALLEGRO_OPENGL in al_set_new_display_flags)

If it is related to OpenGL, I think that "display_thread_proc" in "wgl_disp.c" needs a review, because there are an ugly hack/loop for DInput (which is not used anymore).

Trent Gamblin
Member #261
April 2000
avatar

It's a D3D bug. It has to do with matching the best display format.

Thomas Fjellstrom
Member #476
June 2000
avatar

It's a D3D bug. It has to do with matching the best display format.

Except it seems he's setting ALLEGRO_OPENGL?

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Trent Gamblin
Member #261
April 2000
avatar

Hmm in that case I don't know ???

Aaron Bolyard
Member #7,537
July 2006
avatar

Thanks for the info. I won't use that code myself (as I said I was just fiddling with it).

I found another crash that only happens occasionally. Basically, when my program exits, it crashes some place in d3d_shutdown. The exact place tends to be rather random. The example is as follows:

#SelectExpand
1int main(void) 2{ 3 ALLEGRO_DISPLAY * display; 4 5 if (!al_init()) 6 return 1; 7 8 al_set_new_display_flags(ALLEGRO_WINDOWED & ALLEGRO_OPENGL); 9 al_set_new_display_option(ALLEGRO_SAMPLE_BUFFERS, 1, ALLEGRO_SUGGEST); 10 al_set_new_display_option(ALLEGRO_SAMPLES, 16, ALLEGRO_SUGGEST); 11 al_set_new_display_option(ALLEGRO_STENCIL_SIZE, 8, ALLEGRO_SUGGEST); 12 13 display = al_create_display(640, 480); 14 15 if (!display) 16 return 1; 17 18 al_set_window_title(display, "Bright Side"); 19 al_set_window_position(display, 0, 0); 20 al_toggle_display_flag(display, ALLEGRO_NOFRAME, true); 21 22 al_flip_display(); 23 24 al_destroy_display(display); 25 26 al_uninstall_system(); 27 28 return 0; 29}

Sorry for any inconvenience!

edit: Seems to only happen due to al_toggle_display_flag. Without it I haven't encountered a crash yet.

Thomas Fjellstrom
Member #476
June 2000
avatar

Ohh.. I noticed something quite wrong in your code.

Do not use & to combine flags. use |.

Please re try both of your examples!

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Trent Gamblin
Member #261
April 2000
avatar

al_set_new_display_flags(ALLEGRO_WINDOWED & ALLEGRO_OPENGL);

I think you want an | there not an &. However, this may be a legitimate bug. Thanks.

Aaron Bolyard
Member #7,537
July 2006
avatar

Oh duh! Sorry and I'll try it again.

edit: Yea that seems to be the problem (same with the previous one, probably). Sorry for wasting everyone's time! (my excuse is I haven't used bit operations in a long time, but that's a rather lame excuse... "Oh, I haven't ridden a bike in four years! How will I remember?")

edit: Actually that really should have no effect. ALLEGRO_OPENGL & ALLEGRO_WINDOWED is 0. Would that not be a valid input? After all, it'd just default to the regular settings (or am I wrong?). In any case, I encountered a crash again after doing some other stuff, tried the code previously with the fix, and lo and behold it happens. So I guess I wasn't wasting anyone's time.

Trent Gamblin
Member #261
April 2000
avatar

So let me get this straight. It's crashing when using the OpenGL driver and when using the D3D driver, or is it one or the other?

Aaron Bolyard
Member #7,537
July 2006
avatar

I haven't had it crash yet with OpenGL, just Direct3D in d3d_shutdown.

Trent Gamblin
Member #261
April 2000
avatar

If you're using ALLEGRO_OPENGL then you're using OpenGL not D3D. Memory corruption could cause it to appear to crash in the d3d driver. I just want to make it clear, so could you please post the code that crashes?

Aaron Bolyard
Member #7,537
July 2006
avatar

By Direct3D I mean when I do not set any flags (through al_set_new_display_flags).

When I use Direct3D it crashes (by using the code below) at the end of the program:

al_set_new_display_flags(0); /* Or just not calling it at all. */

And this does not crash at the end:

al_set_new_display_flags(ALLEGRO_OPENGL)

The example I am using is just this:

#SelectExpand
1int main(void) 2{ 3 ALLEGRO_DISPLAY * display; 4 5 if (!al_init()) 6 return 1; 7 8 al_set_new_display_option(ALLEGRO_SAMPLE_BUFFERS, 1, ALLEGRO_SUGGEST); 9 al_set_new_display_option(ALLEGRO_SAMPLES, 16, ALLEGRO_SUGGEST); 10 al_set_new_display_option(ALLEGRO_STENCIL_SIZE, 8, ALLEGRO_SUGGEST); 11 12 display = al_create_display(640, 480); 13 14 if (!display) 15 return 1; 16 17 al_set_window_title(display, "Bright Side"); 18 al_set_window_position(display, 0, 0); 19 al_toggle_display_flag(display, ALLEGRO_NOFRAME, true); 20 21 al_flip_display(); 22 23 al_destroy_display(display); 24 25 al_uninstall_system(); 26 27 return 0; 28}

By default, this would use the Direct3D driver on Windows, or am I wrong?

Trent Gamblin
Member #261
April 2000
avatar

Yes, that's right. But since you were using ALLEGRO_OPENGL in all of your previous examples I had to verify.

Aaron Bolyard
Member #7,537
July 2006
avatar

I really don't mean to be a pain but I found a problem with getting display modes in OpenGL. The "height" member in ALLEGRO_DISPLAY_MODE is never set. I looked at the source and understand why the pixel format is not filled, so I ignore that for OpenGL contexts, but the height is important. Code is like so:

ALLEGRO_DISPLAY_MODE mode;
al_set_new_display_option(ALLEGRO_SAMPLE_BUFFERS, 1, ALLEGRO_SUGGEST);
al_set_new_display_option(ALLEGRO_SAMPLES, 16, ALLEGRO_SUGGEST);
al_set_new_display_option(ALLEGRO_STENCIL_SIZE, 8, ALLEGRO_SUGGEST);
al_get_display_mode(0, &mode)

printf("%d %d", mode.width, mode.height) /* Prints 640 0 (for example). */

David Capello
Member #708
October 2000

But since you were using ALLEGRO_OPENGL in all of your previous examples I had to verify.

Aaron was not using OpenGL really, see the Thomas Fjellstrom comment, he was using:

(ALLEGRO_WINDOWED & ALLEGRO_OPENGL) = (1 & 4) = 0 (& instead of |)

  al_set_new_display_flags(0);

I missed it too.

Trent Gamblin
Member #261
April 2000
avatar

Aaron was not using OpenGL really, see the Thomas Fjellstrom comment, he was using:

I noticed that but assumed he was still using OpenGL after correcting that.

Aaron, if you're able to repeat this bug, could you please try adding a delay (Try Sleep(1000) on windows) after al_uninstall_sytem and before returning from main? I think it's a race condition. I was only able to reproduce it once though so I'm not sure.

Trezker
Member #1,739
December 2001
avatar

I started using the filechooser in Cumulate and I'm annoyed by this error that shows up every time I use it.

** (<unknown>:16706): CRITICAL **: giop_thread_request_push: assertion `tdata != NULL' failed

I've tried to replicate it in a small example program but can't make it happen there. But in Cumulate it happens even in the simplest possible use of filechooser, create, show and destroy.

Usage can be found in this file.
https://github.com/trezker/Cumulate/blob/master/editor/file.cpp

Trent Gamblin
Member #261
April 2000
avatar

Aaron, for the second bug about OpenGL display modes, try the patch attached to this post.

Aaron Bolyard
Member #7,537
July 2006
avatar

The patch worked; thanks a bunch!

Trent Gamblin
Member #261
April 2000
avatar

YW. What about the delay I suggested a couple posts above?



Go to: