Skip to content

Commit

Permalink
Platform deinit should happen last, since other deinit bits might dep…
Browse files Browse the repository at this point in the history
…end on it.
  • Loading branch information
icculus committed Sep 8, 2016
1 parent dfd658f commit ab7eb81
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/physfs.c
Expand Up @@ -1286,8 +1286,6 @@ static void freeArchivers(void)

static int doDeinit(void)
{
BAIL_IF_MACRO(!__PHYSFS_platformDeinit(), ERRPASS, 0);

closeFileHandleList(&openWriteList);
BAIL_IF_MACRO(!PHYSFS_setWriteDir(NULL), PHYSFS_ERR_FILES_STILL_OPEN, 0);

Expand Down Expand Up @@ -1335,6 +1333,10 @@ static int doDeinit(void)
allocator.Deinit();

errorLock = stateLock = NULL;

/* !!! FIXME: what on earth are you supposed to do if this fails? */
BAIL_IF_MACRO(!__PHYSFS_platformDeinit(), ERRPASS, 0);

return 1;
} /* doDeinit */

Expand Down

0 comments on commit ab7eb81

Please sign in to comment.