5.1.1 GL Window on Windows Takes longer to close than 5.1.0?
jmasterx

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

Destroy your bitmaps before the display?

jmasterx

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

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

jmasterx

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

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

jmasterx

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

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

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

Thomas Fjellstrom

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! ;)

Peter Wang

The bitmap conversion changes were in the 5.1.0 release.

Thomas Fjellstrom

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?

Thread #609535. Printed from Allegro.cc