From a1d9e9c1fbc391d920dc07e83c653535b7016f0f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 31 Mar 2021 18:26:51 +0300 Subject: Dbx_sqlite: contact deletion hook should be called before, not after physical contact deletion --- plugins/Dbx_sqlite/src/dbcontacts.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'plugins/Dbx_sqlite/src/dbcontacts.cpp') diff --git a/plugins/Dbx_sqlite/src/dbcontacts.cpp b/plugins/Dbx_sqlite/src/dbcontacts.cpp index 63c5dc4695..0fb15f7082 100755 --- a/plugins/Dbx_sqlite/src/dbcontacts.cpp +++ b/plugins/Dbx_sqlite/src/dbcontacts.cpp @@ -82,6 +82,12 @@ LONG CDbxSQLite::DeleteContact(MCONTACT hContact) if (hContact == 0) return 1; + DBCachedContact *cc = m_cache->GetCachedContact(hContact); + if (cc == nullptr) + return 1; + + NotifyEventHooks(g_hevContactDeleted, hContact); + mir_cslockfull lock(m_csDbAccess); sqlite3_stmt *stmt = ctc_stmts[SQL_CTC_STMT_DELETEEVENTS].pQuery; @@ -117,9 +123,7 @@ LONG CDbxSQLite::DeleteContact(MCONTACT hContact) return 1; m_cache->FreeCachedContact(hContact); - lock.unlock(); - NotifyEventHooks(g_hevContactDeleted, hContact); DBFlush(); return 0; -- cgit v1.2.3