diff options
-rw-r--r-- | src/mir_app/src/mdatabasecache.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mir_app/src/mdatabasecache.cpp b/src/mir_app/src/mdatabasecache.cpp index 83ab81790d..6c78fcf8b1 100644 --- a/src/mir_app/src/mdatabasecache.cpp +++ b/src/mir_app/src/mdatabasecache.cpp @@ -187,6 +187,7 @@ STDMETHODIMP_(DBVARIANT*) MDatabaseCache::GetCachedValuePtr(MCONTACT contactID, if (index != -1) {
V = m_lGlobalSettings[index];
if (bAllocate == -1) {
+ mir_cslock lck(m_csVal);
FreeCachedVariant(&V->value);
m_lGlobalSettings.remove(index);
HeapFree(m_hCacheHeap, 0, V);
@@ -197,6 +198,7 @@ STDMETHODIMP_(DBVARIANT*) MDatabaseCache::GetCachedValuePtr(MCONTACT contactID, if (bAllocate != 1)
return nullptr;
+ mir_cslock lck(m_csVal);
V = (DBCachedGlobalValue*)HeapAlloc(m_hCacheHeap, HEAP_ZERO_MEMORY, sizeof(DBCachedGlobalValue));
V->name = szSetting;
m_lGlobalSettings.insert(V);
@@ -225,6 +227,7 @@ STDMETHODIMP_(DBVARIANT*) MDatabaseCache::GetCachedValuePtr(MCONTACT contactID, if (bAllocate != 1)
return nullptr;
+ mir_cslock lck(m_csVal);
V = (DBCachedContactValue *)HeapAlloc(m_hCacheHeap, HEAP_ZERO_MEMORY, sizeof(DBCachedContactValue));
if (cc->last)
cc->last->next = V;
@@ -234,6 +237,7 @@ STDMETHODIMP_(DBVARIANT*) MDatabaseCache::GetCachedValuePtr(MCONTACT contactID, V->name = szSetting;
}
else if (bAllocate == -1) {
+ mir_cslock lck(m_csVal);
m_lastVL = nullptr;
FreeCachedVariant(&V->value);
if (cc->first == V) {
|