Skip to content
Browse files

fixed crash when CLocalizeStrings::Load() is called from multiple thr…

…eads, which is possible when called by add-ons.
  • Loading branch information...
1 parent 29aa6cf commit 9e4c515c5426bef749594610fb4915c5d4e3acaf @opdenkamp opdenkamp committed
Showing with 4 additions and 0 deletions.
  1. +2 −0 xbmc/guilib/LocalizeStrings.cpp
  2. +2 −0 xbmc/guilib/LocalizeStrings.h
View
2 xbmc/guilib/LocalizeStrings.cpp
@@ -27,6 +27,7 @@
#include "utils/URIUtils.h"
#include "utils/POUtils.h"
#include "filesystem/Directory.h"
+#include "threads/SingleLock.h"
CLocalizeStrings::CLocalizeStrings(void)
{
@@ -188,6 +189,7 @@ bool CLocalizeStrings::Load(const CStdString& strPathName, const CStdString& str
bool bLoadFallback = !strLanguage.Equals(SOURCE_LANGUAGE);
CStdString encoding;
+ CSingleLock lock(m_critSection);
Clear();
if (!LoadStr2Mem(strPathName, strLanguage, encoding))
View
2 xbmc/guilib/LocalizeStrings.h
@@ -29,6 +29,7 @@
*/
#include "utils/StdString.h"
+#include "threads/CriticalSection.h"
#include <map>
@@ -101,6 +102,7 @@ class CLocalizeStrings
static const uint32_t block_size = 4096;
std::map<CStdString, uint32_t> m_blocks;
typedef std::map<CStdString, uint32_t>::iterator iBlocks;
+ CCriticalSection m_critSection;
};
/*!

0 comments on commit 9e4c515

Please sign in to comment.
Something went wrong with that request. Please try again.