use destructor attribute for W_Shutdown

makes sure this is always called in any case
also just simpler
This commit is contained in:
Alug 2026-05-03 13:33:21 -04:00 committed by NepDisk
parent 247c3cb323
commit 9f52b1e158
3 changed files with 1 additions and 7 deletions

View file

@ -1444,7 +1444,6 @@ void I_Quit(void)
if (myargmalloc)
free(myargv); // Deallocate allocated memory
W_Shutdown();
exit(0);
}
@ -1522,7 +1521,6 @@ FUNCIERROR void ATTRNORETURN I_Error(const char *error, ...)
"SRB2Kart V2 " VERSIONSTRING " Recursive Error",
buffer, NULL);
W_Shutdown();
exit(-1); // recursive errors detected
}
}
@ -1570,8 +1568,6 @@ FUNCIERROR void ATTRNORETURN I_Error(const char *error, ...)
I_ShutdownSystem();
SDL_Quit();
W_Shutdown();
#if defined (PARANOIA) || defined (DEVELOP)
*(volatile INT32 *)0 = 4; //Alam: Debug!
#endif

View file

@ -125,7 +125,7 @@ wadfile_t *wadfiles[MAX_WADFILES]; // 0 to numwadfiles-1 are valid
// If not done on a Mac then open wad files
// can prevent removable media they are on from
// being ejected
void W_Shutdown(void)
DESTRUCTOR static void W_Shutdown(void)
{
lumpnum_map_cleanup(&lumpnumcache);

View file

@ -152,8 +152,6 @@ extern wadfile_t *wadfiles[MAX_WADFILES];
// =========================================================================
void W_Shutdown(void);
// Opens a WAD file. Returns the FILE * handle for the file, or NULL if not found or could not be opened
FILE *W_OpenWadFile(const char **filename, boolean useerrors);
// Load and add a wadfile to the active wad files, returns numbers of lumps, INT16_MAX on error