From 521a90585a7dcf3689ed70f54f91d4500529fbee Mon Sep 17 00:00:00 2001 From: jp9000 Date: Fri, 23 Jan 2015 16:56:58 -0800 Subject: [PATCH] Revert "Add a horrible mutex to make ConfigFile thread-safe" This reverts commit 3eb8e2d41fc99dba8765e301adf3758df5e0f314. Fixes a number of isses with ConfigFile, and prevents the hotkey thread from potentially corrupting the config file. --- OBSApi/Utility/ConfigFile.cpp | 117 ---------------------------------- OBSApi/Utility/ConfigFile.h | 3 +- 2 files changed, 1 insertion(+), 119 deletions(-) diff --git a/OBSApi/Utility/ConfigFile.cpp b/OBSApi/Utility/ConfigFile.cpp index 0b264ee5..d76a3601 100644 --- a/OBSApi/Utility/ConfigFile.cpp +++ b/OBSApi/Utility/ConfigFile.cpp @@ -65,8 +65,6 @@ BOOL ConfigFile::LoadFile(DWORD dwOpenMode) return 0; } - OSEnterMutex(hHorribleThreadSafetyMutex); - if(bOpen) Close(); @@ -95,14 +93,11 @@ BOOL ConfigFile::LoadFile(DWORD dwOpenMode) bOpen = 1; - OSLeaveMutex(hHorribleThreadSafetyMutex); - return 1; } void ConfigFile::LoadData() { - OSEnterMutex(hHorribleThreadSafetyMutex); TSTR lpCurLine = lpFileData, lpNextLine; ConfigSection *lpCurSection=NULL; DWORD i; @@ -161,13 +156,10 @@ void ConfigFile::LoadData() *lpNextLine = '\r'; } - - OSLeaveMutex(hHorribleThreadSafetyMutex); } void ConfigFile::Close() { - OSEnterMutex(hHorribleThreadSafetyMutex); DWORD i,j,k; for(i=0; i &IntList) { - OSEnterMutex(hHorribleThreadSafetyMutex); assert(lpSection); assert(lpKey); @@ -565,13 +501,11 @@ BOOL ConfigFile::GetIntList(CTSTR lpSection, CTSTR lpKey, List &IntList) } } - OSLeaveMutex(hHorribleThreadSafetyMutex); return bFoundKey; } BOOL ConfigFile::GetFloatList(CTSTR lpSection, CTSTR lpKey, List &FloatList) { - OSEnterMutex(hHorribleThreadSafetyMutex); assert(lpSection); assert(lpKey); @@ -597,13 +531,11 @@ BOOL ConfigFile::GetFloatList(CTSTR lpSection, CTSTR lpKey, List &FloatLi } } - OSLeaveMutex(hHorribleThreadSafetyMutex); return bFoundKey; } BOOL ConfigFile::GetColorList(CTSTR lpSection, CTSTR lpKey, List &ColorList) { - OSEnterMutex(hHorribleThreadSafetyMutex); assert(lpSection); assert(lpKey); @@ -677,7 +609,6 @@ BOOL ConfigFile::GetColorList(CTSTR lpSection, CTSTR lpKey, List &ColorL } } - OSLeaveMutex(hHorribleThreadSafetyMutex); return bFoundKey; } @@ -820,7 +751,6 @@ void ConfigFile::SetColorList(CTSTR lpSection, CTSTR lpKey, List &ColorL BOOL ConfigFile::HasKey(CTSTR lpSection, CTSTR lpKey) { - OSEnterMutex(hHorribleThreadSafetyMutex); for(unsigned int i=0; i