From 4304b2d5667e36d1a14e3ae13a03e7f537f57f9a Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Wed, 16 Mar 2016 17:26:51 +0000 Subject: temporary reverted git-svn-id: http://svn.miranda-ng.org/main/trunk@16486 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Dbx_mdb/src/dbcontacts.cpp | 8 ++++---- plugins/Dbx_mdb/src/dbevents.cpp | 17 ++++++++--------- 2 files changed, 12 insertions(+), 13 deletions(-) (limited to 'plugins/Dbx_mdb') diff --git a/plugins/Dbx_mdb/src/dbcontacts.cpp b/plugins/Dbx_mdb/src/dbcontacts.cpp index 0aa4206854..f19811b10e 100644 --- a/plugins/Dbx_mdb/src/dbcontacts.cpp +++ b/plugins/Dbx_mdb/src/dbcontacts.cpp @@ -91,11 +91,13 @@ STDMETHODIMP_(LONG) CDbxMdb::DeleteContact(MCONTACT contactID) return 1; // delete + // call notifier while outside mutex + NotifyEventHooks(hContactDeletedEvent, contactID, 0); mir_cslockfull lck(m_csDbAccess); { - LIST events(25); + LIST events(50); GatherContactHistory(contactID, events); while (events.getCount()) { @@ -142,10 +144,8 @@ STDMETHODIMP_(LONG) CDbxMdb::DeleteContact(MCONTACT contactID) if (contactID == m_hLastCachedContact) m_hLastCachedContact = NULL; - lck.unlock(); - // call notifier while outside mutex - NotifyEventHooks(hContactDeletedEvent, contactID, 0); + lck.unlock(); return 0; } diff --git a/plugins/Dbx_mdb/src/dbevents.cpp b/plugins/Dbx_mdb/src/dbevents.cpp index ee6c354e84..466cd3b452 100644 --- a/plugins/Dbx_mdb/src/dbevents.cpp +++ b/plugins/Dbx_mdb/src/dbevents.cpp @@ -72,12 +72,10 @@ STDMETHODIMP_(MEVENT) CDbxMdb::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei) BYTE *pBlob = dbei->pBlob; mir_ptr pCryptBlob; - if (m_bEncrypted) - { + if (m_bEncrypted) { size_t len; BYTE *pResult = m_crypto->encodeBuffer(pBlob, dbe.cbBlob, &len); - if (pResult != nullptr) - { + if (pResult != NULL) { pCryptBlob = pBlob = pResult; dbe.cbBlob = (DWORD)len; dbe.flags |= DBEF_ENCRYPTED; @@ -157,8 +155,8 @@ STDMETHODIMP_(BOOL) CDbxMdb::DeleteEvent(MCONTACT contactID, MEVENT hDbEvent) cc2 = m_cache->GetCachedContact(dbe->contactID); } - const auto Snapshot = [&cc, &cc2]() { cc->Snapshot(); if (cc2) cc2->Snapshot(); }; - const auto Revert = [&cc, &cc2]() { cc->Revert(); if (cc2) cc2->Revert(); }; + const auto Snapshot = [&]() { cc->Snapshot(); if (cc2) cc2->Snapshot(); }; + const auto Revert = [&]() { cc->Revert(); if (cc2) cc2->Revert(); }; for (Snapshot();; Revert(), Remap()) { @@ -248,18 +246,19 @@ STDMETHODIMP_(BOOL) CDbxMdb::GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbei) dbei->cbBlob = dbe->cbBlob; if (bytesToCopy && dbei->pBlob) { - const BYTE *pSrc = (BYTE*)data.mv_data + sizeof(DBEvent); + BYTE *pSrc = (BYTE*)data.mv_data + sizeof(DBEvent); if (dbe->flags & DBEF_ENCRYPTED) { dbei->flags &= ~DBEF_ENCRYPTED; size_t len; - mir_ptr pBlob((BYTE*)m_crypto->decodeBuffer(pSrc, dbe->cbBlob, &len)); - if (pBlob == nullptr) + BYTE* pBlob = (BYTE*)m_crypto->decodeBuffer(pSrc, dbe->cbBlob, &len); + if (pBlob == NULL) return 1; memcpy(dbei->pBlob, pBlob, bytesToCopy); if (bytesToCopy > len) memset(dbei->pBlob + len, 0, bytesToCopy - len); + mir_free(pBlob); } else memcpy(dbei->pBlob, pSrc, bytesToCopy); } -- cgit v1.2.3