From ab7eb81a4a519f8379e5a2d09dd527662a474397 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 7 Sep 2016 21:21:59 -0400 Subject: [PATCH] Platform deinit should happen last, since other deinit bits might depend on it. --- src/physfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/physfs.c b/src/physfs.c index d1846259..71bb09b3 100644 --- a/src/physfs.c +++ b/src/physfs.c @@ -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); @@ -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 */