diff options
Diffstat (limited to 'plugins/AVS/src')
-rw-r--r-- | plugins/AVS/src/cache.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/plugins/AVS/src/cache.cpp b/plugins/AVS/src/cache.cpp index bb04abaf2d..6b4ac7417e 100644 --- a/plugins/AVS/src/cache.cpp +++ b/plugins/AVS/src/cache.cpp @@ -75,20 +75,23 @@ CacheNode* FindAvatarInCache(MCONTACT hContact, bool add, bool findAny) if (szProto == nullptr || !db_get_b(NULL, AVS_MODULE, szProto, 1))
return nullptr;
- mir_cslock lck(cachecs);
- CacheNode *cc = arCache.find((CacheNode*)&hContact);
- if (cc) {
- cc->t_lastAccess = time(nullptr);
- return (cc->loaded || findAny) ? cc : nullptr;
- }
+ CacheNode *cc;
+ {
+ mir_cslock lck(cachecs);
+ cc = arCache.find((CacheNode*)&hContact);
+ if (cc) {
+ cc->t_lastAccess = time(nullptr);
+ return (cc->loaded || findAny) ? cc : nullptr;
+ }
- // not found
- if (!add)
- return nullptr;
+ // not found
+ if (!add)
+ return nullptr;
- cc = new CacheNode();
- cc->hContact = hContact;
- arCache.insert(cc);
+ cc = new CacheNode();
+ cc->hContact = hContact;
+ arCache.insert(cc);
+ }
switch (CreateAvatarInCache(hContact, cc, nullptr)) {
case -2: // no avatar data in settings, retrieve
|