Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/cmserr.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ static
void* defMtxCreate(cmsContext id)
{
_cmsMutex* ptr_mutex = (_cmsMutex*) _cmsMalloc(id, sizeof(_cmsMutex));
if (ptr_mutex == NULL) return NULL;
_cmsInitMutexPrimitive(ptr_mutex);
return (void*) ptr_mutex;
}
Expand Down Expand Up @@ -680,7 +681,7 @@ void CMSEXPORT _cmsDestroyMutex(cmsContext ContextID, void* mtx)
{
_cmsMutexPluginChunkType* ptr = (_cmsMutexPluginChunkType*) _cmsContextGetClientChunk(ContextID, MutexPlugin);

if (ptr ->DestroyMutexPtr != NULL) {
if (ptr ->DestroyMutexPtr != NULL && mtx != NULL) {

ptr ->DestroyMutexPtr(ContextID, mtx);
}
Expand All @@ -690,7 +691,7 @@ cmsBool CMSEXPORT _cmsLockMutex(cmsContext ContextID, void* mtx)
{
_cmsMutexPluginChunkType* ptr = (_cmsMutexPluginChunkType*) _cmsContextGetClientChunk(ContextID, MutexPlugin);

if (ptr ->LockMutexPtr == NULL) return TRUE;
if (ptr ->LockMutexPtr == NULL || mtx == NULL) return TRUE;

return ptr ->LockMutexPtr(ContextID, mtx);
}
Expand All @@ -699,7 +700,7 @@ void CMSEXPORT _cmsUnlockMutex(cmsContext ContextID, void* mtx)
{
_cmsMutexPluginChunkType* ptr = (_cmsMutexPluginChunkType*) _cmsContextGetClientChunk(ContextID, MutexPlugin);

if (ptr ->UnlockMutexPtr != NULL) {
if (ptr ->UnlockMutexPtr != NULL && mtx != NULL) {

ptr ->UnlockMutexPtr(ContextID, mtx);
}
Expand Down
Loading