From 629e5cf4e00da219d4f2266b98ae748695423dba Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Sat, 10 Sep 2011 01:27:01 +0000
Subject: [PATCH] Fix bug in listLock and listUnlock where
 pthread_mutex_lock/unlock was being called for non-mutex-protected lists
 causing exceptions on Windows.

---
 src/xpdev/link_list.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/xpdev/link_list.c b/src/xpdev/link_list.c
index 6680b4b2ae..d0f2d8acbc 100644
--- a/src/xpdev/link_list.c
+++ b/src/xpdev/link_list.c
@@ -239,7 +239,7 @@ BOOL DLLCALL listLock(link_list_t* list)
 	if(list==NULL)
 		return(FALSE);
 #if defined(LINK_LIST_THREADSAFE)
-	if((ret=pthread_mutex_lock(&list->mutex))==0)
+	if((list->flags&LINK_LIST_MUTEX) && (ret=pthread_mutex_lock(&list->mutex))==0)
 #endif
 		list->locks++;
 	return(ret);
@@ -259,7 +259,7 @@ BOOL DLLCALL listUnlock(link_list_t* list)
 	if(list==NULL)
 		return(FALSE);
 #if defined(LINK_LIST_THREADSAFE)
-	if((ret=pthread_mutex_unlock(&list->mutex))==0)
+	if((list->flags&LINK_LIST_MUTEX) && (ret=pthread_mutex_unlock(&list->mutex))==0)
 #endif
 		list->locks--;
 	return(ret);
-- 
GitLab