summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-02-19 21:15:18 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-02-19 21:15:18 +0300
commit6eae86b1637f5f2c4601250aa731d6cef0b72260 (patch)
tree3476a4d14788893b9b35b12286e0d07c675ae149 /src/mir_app
parentadaf7196c187cc926146fa65ff1f68a0a1ef3531 (diff)
fix for a random crash after contact's removal
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/src/mdatabasecache.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/mir_app/src/mdatabasecache.cpp b/src/mir_app/src/mdatabasecache.cpp
index aa09fad9e3..9f769a1f7b 100644
--- a/src/mir_app/src/mdatabasecache.cpp
+++ b/src/mir_app/src/mdatabasecache.cpp
@@ -229,14 +229,16 @@ STDMETHODIMP_(DBVARIANT*) MDatabaseCache::GetCachedValuePtr(MCONTACT contactID,
// a contact setting
DBCachedContactValue *V, *V1;
DBCachedContact ccTemp, *cc;
+ {
+ mir_cslock lck(m_csContact);
+ ccTemp.contactID = contactID;
- ccTemp.contactID = contactID;
-
- int index = m_lContacts.getIndex(&ccTemp);
- if (index == -1)
- return nullptr;
+ int index = m_lContacts.getIndex(&ccTemp);
+ if (index == -1)
+ return nullptr;
- m_lastVL = cc = m_lContacts[index];
+ m_lastVL = cc = m_lContacts[index];
+ }
for (V = cc->first; V != nullptr; V = V->next)
if (V->name == szSetting)