Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » 5.1.1 GL Window on Windows Takes longer to close than 5.1.0?

This thread is locked; no one can reply to it. rss feed Print
5.1.1 GL Window on Windows Takes longer to close than 5.1.0?
jmasterx
Member #11,410
October 2009

I have just compiled binaries for 5.1.1 and tried it on my project. I noticed that now when I close the window, it takes about 2 seconds for it to close. I reverted back to 5.1.0 to see if it would close like normal and it did. If I use D3D this does not happen, only with OpenGL.

There is nothing special in my close code.

Is there something new added that I need to consider?

Thanks

Thomas Fjellstrom
Member #476
June 2000
avatar

Destroy your bitmaps before the display?

--
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

jmasterx
Member #11,410
October 2009

I'll try that when I get home. I'm sure that is it. Thanks.

Though, why did it not do this before 5.1.1?

Thomas Fjellstrom
Member #476
June 2000
avatar

5.1.1 has some new bitmap conversion semantics. It's possible that the new rules leave it so it won't auto download textures on exit (which makes sense, its silly to download them all if all you're doing is exiting).

--
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

jmasterx
Member #11,410
October 2009

I checked the order and it seems correct:

#SelectExpand
1 Core::~Core(void) 2 { 3 4 delete sceneManager; 5 delete settings; 6 delete m_cardImageManager; 7 delete m_languageManager; 8 delete m_colorManager; 9 delete m_dynamicUIManager; 10 delete m_fontManager; 11 delete m_spriteManager; 12 delete appIcon; 13 delete display; 14 _deinitAllegro(); 15 } 16 17 void Core::_deinitAllegro() 18 { 19 al_uninstall_keyboard(); 20 al_uninstall_mouse(); 21 al_uninstall_audio(); 22 al_uninstall_system(); 23 }

If I remove the call to al_destroy_display the speed is normal. But if I deinit Allegro before destroying the display it crashes so that does not work.

Matthew Leverton
Supreme Loser
January 1999
avatar

Walk through a debugger and see if there's any particular call that takes two seconds.

jmasterx
Member #11,410
October 2009

It spent 1.37s doing al_clone_bitmap.

static void destroy_display_internals(ALLEGRO_DISPLAY_WGL *wgl_disp)
void _al_convert_to_memory_bitmap(ALLEGRO_BITMAP *bitmap)
void al_convert_bitmap(ALLEGRO_BITMAP *bitmap)
ALLEGRO_BITMAP *al_clone_bitmap(ALLEGRO_BITMAP *bitmap)

Which is strange because my #of calls to al_destroy_bitmap == #calls to al_load_bitmap.

Matthew Leverton
Supreme Loser
January 1999
avatar

Check your al_create_bitmap calls, etc, along with your fonts.

Maybe even update al_clone_bitmap() to log some info about the size of the bitmap, etc to help give a hint. (Or check the values in the debugger, if possible.)

jmasterx
Member #11,410
October 2009

Turns out I had not declared my Agui Image destructor virtual. Thanks for the help!

Thomas Fjellstrom
Member #476
June 2000
avatar

The fact that its calling _al_convert_to_memory_bitmap tells me that you weren't actually destroying the bitmaps before the display. It's something to look out for.

jmasterx said:

Turns out I had not declared my Agui Image destructor virtual. Thanks for the help!

And that tells me I'm correct! ;)

--
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

The bitmap conversion changes were in the 5.1.0 release.

Thomas Fjellstrom
Member #476
June 2000
avatar

Oh well then. Shows what I know :-X

The bitmap conversion changes were in the 5.1.0 release.

The code wasn't tweaked at all in 5.1.1 over 5.1.0?

--
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

Go to: