diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-05 14:38:28 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-06 20:40:22 -0500 |
commit | 7045802f27f3efe74b4ed9146d33abe253df043a (patch) | |
tree | 22ce4c91571d608e6ca10e1220285f1c720c36d8 /svl | |
parent | 9611851a5349f564ba97bacd9619eb8b329ae283 (diff) |
Add mutex to guard the shared string pool content.
Change-Id: I0eb97d0fbeaefd8a1c86d240ed8bd7f208fb662e
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/misc/sharedstringpool.cxx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/svl/source/misc/sharedstringpool.cxx b/svl/source/misc/sharedstringpool.cxx index 46bf814f8468..1e85da589bf9 100644 --- a/svl/source/misc/sharedstringpool.cxx +++ b/svl/source/misc/sharedstringpool.cxx @@ -17,6 +17,8 @@ SharedStringPool::SharedStringPool( const CharClass* pCharClass ) : mpCharClass( SharedString SharedStringPool::intern( const OUString& rStr ) { + osl::MutexGuard aGuard(&maMutex); + InsertResultType aRes = findOrInsert(maStrPool, rStr); if (aRes.first == maStrPool.end()) // Insertion failed. @@ -63,6 +65,8 @@ inline sal_Int32 getRefCount( const rtl_uString* p ) void SharedStringPool::purge() { + osl::MutexGuard aGuard(&maMutex); + StrHashType aNewStrPool; StrHashType::iterator it = maStrPool.begin(), itEnd = maStrPool.end(); for (; it != itEnd; ++it) @@ -98,11 +102,13 @@ void SharedStringPool::purge() size_t SharedStringPool::getCount() const { + osl::MutexGuard aGuard(&maMutex); return maStrPool.size(); } size_t SharedStringPool::getCountIgnoreCase() const { + osl::MutexGuard aGuard(&maMutex); return maStrPoolUpper.size(); } |