remove deleted games from games list

Was getting crashes since they could still be looked up
This commit is contained in:
Eric House 2021-02-23 16:13:44 -08:00
parent 61be81cf1a
commit ffc42ed5e0

View file

@ -528,9 +528,21 @@ cleanupGame( GameState* gs )
static void
deleteGame( GameState* gs )
{
Globals* globals = gs->globals;
int gameID = gs->gi.gameID; /* remember it */
cleanupGame( gs );
// Remove from linked list, but don't actually free because could live in
// a js-side object still. Needs refcounting or somesuch
GameState** prev = &globals->games;
for ( GameState* cur = globals->games; !!cur; cur = cur->next ) {
if ( gs == cur ) {
*prev = cur->next;
break;
}
prev = &cur->next;
}
char key[32];
formatNameKey( key, sizeof(key), gameID );
remove_stored_value( key );