Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…eads, which is possible when called by add-ons.
  • Loading branch information...
commit 9e4c515c5426bef749594610fb4915c5d4e3acaf 1 parent 29aa6cf
Lars Op den Kamp opdenkamp authored
2  xbmc/guilib/LocalizeStrings.cpp
View
@@ -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))
2  xbmc/guilib/LocalizeStrings.h
View
@@ -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;
};
/*!
Please sign in to comment.
Something went wrong with that request. Please try again.