Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » [A5.1 SVN] crash when ending application

This thread is locked; no one can reply to it. rss feed Print
[A5.1 SVN] crash when ending application
tobing
Member #5,213
November 2004
avatar

Since lately, my game crashes during exit. I've tracked down this to

static void shutdown_system_driver(void)


in system.c, where a destructor call for user_exe_path is called, on already destroyed data. It helps to move the new lines up, like this:

#SelectExpand
1static void shutdown_system_driver(void) 2{ 3 if (active_sysdrv) { 4 ALLEGRO_CONFIG *temp = active_sysdrv->config; 5 if (active_sysdrv->user_exe_path) <<-- new lines 6 al_destroy_path(active_sysdrv->user_exe_path); <<-- must be called before shutdown_system() 7 if (active_sysdrv->vt && active_sysdrv->vt->shutdown_system) 8 active_sysdrv->vt->shutdown_system(); 9 active_sysdrv = NULL; 10 /* active_sysdrv is not accessible here so we copied it */ 11 al_destroy_config(temp); 12 13 while (!_al_vector_is_empty(&_al_system_interfaces)) 14 _al_vector_delete_at(&_al_system_interfaces, _al_vector_size(&_al_system_interfaces)-1); 15 _al_vector_free(&_al_system_interfaces); 16 _al_vector_init(&_al_system_interfaces, sizeof(ALLEGRO_SYSTEM_INTERFACE *)); 17 } 18}

Trent Gamblin
Member #261
April 2000
avatar

Makes sense, but it's not destroying it twice, it's trying to access user_exe_path through a freed pointer.

kazzmir
Member #1,786
December 2001
avatar

It doesn't look like the user_exe_path has anything to do with with current driver. Can you explain why your fix is necessary?

Trent Gamblin
Member #261
April 2000
avatar

My understanding was that active_sysdrv was being freed.

Edit: that comment seems to be erroneuous now.

Elias
Member #358
May 2000

Thanks, I committed it to SVN. (Was also me who had added those 2 lines to the wrong place... just wanted to get my speedhack entry working under Windows and wasn't careful enough :P)

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

Go to: