Fixed a crashbug when calling PHYSFS_deinit() twice in a row.
This commit is contained in:
parent
79800373fa
commit
943904cdd9
11
physfs.c
11
physfs.c
|
@ -111,7 +111,7 @@ static ErrMsg *findErrorForCurrentThread(void)
|
||||||
ErrMsg *i;
|
ErrMsg *i;
|
||||||
PHYSFS_uint64 tid;
|
PHYSFS_uint64 tid;
|
||||||
|
|
||||||
if (initialized)
|
if (errorLock != NULL)
|
||||||
__PHYSFS_platformGrabMutex(errorLock);
|
__PHYSFS_platformGrabMutex(errorLock);
|
||||||
|
|
||||||
if (errorMessages != NULL)
|
if (errorMessages != NULL)
|
||||||
|
@ -122,13 +122,14 @@ static ErrMsg *findErrorForCurrentThread(void)
|
||||||
{
|
{
|
||||||
if (i->tid == tid)
|
if (i->tid == tid)
|
||||||
{
|
{
|
||||||
|
if (errorLock != NULL)
|
||||||
__PHYSFS_platformReleaseMutex(errorLock);
|
__PHYSFS_platformReleaseMutex(errorLock);
|
||||||
return(i);
|
return(i);
|
||||||
} /* if */
|
} /* if */
|
||||||
} /* for */
|
} /* for */
|
||||||
} /* if */
|
} /* if */
|
||||||
|
|
||||||
if (initialized)
|
if (errorLock != NULL)
|
||||||
__PHYSFS_platformReleaseMutex(errorLock);
|
__PHYSFS_platformReleaseMutex(errorLock);
|
||||||
|
|
||||||
return(NULL); /* no error available. */
|
return(NULL); /* no error available. */
|
||||||
|
@ -153,9 +154,13 @@ void __PHYSFS_setError(const char *str)
|
||||||
memset((void *) err, '\0', sizeof (ErrMsg));
|
memset((void *) err, '\0', sizeof (ErrMsg));
|
||||||
err->tid = __PHYSFS_platformGetThreadID();
|
err->tid = __PHYSFS_platformGetThreadID();
|
||||||
|
|
||||||
|
if (errorLock != NULL)
|
||||||
__PHYSFS_platformGrabMutex(errorLock);
|
__PHYSFS_platformGrabMutex(errorLock);
|
||||||
|
|
||||||
err->next = errorMessages;
|
err->next = errorMessages;
|
||||||
errorMessages = err;
|
errorMessages = err;
|
||||||
|
|
||||||
|
if (errorLock != NULL)
|
||||||
__PHYSFS_platformReleaseMutex(errorLock);
|
__PHYSFS_platformReleaseMutex(errorLock);
|
||||||
} /* if */
|
} /* if */
|
||||||
|
|
||||||
|
@ -188,6 +193,8 @@ static void freeErrorMessages(void)
|
||||||
next = i->next;
|
next = i->next;
|
||||||
free(i);
|
free(i);
|
||||||
} /* for */
|
} /* for */
|
||||||
|
|
||||||
|
errorMessages = NULL;
|
||||||
} /* freeErrorMessages */
|
} /* freeErrorMessages */
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue