diff options
author | George Hazan <ghazan@miranda.im> | 2021-03-31 18:26:51 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-03-31 18:26:51 +0300 |
commit | a1d9e9c1fbc391d920dc07e83c653535b7016f0f (patch) | |
tree | b1c84eba686d2127a5e22be52a53fe64f1340afa | |
parent | 94d7f064022edad1e228a2f8c3076f6c609a776f (diff) |
Dbx_sqlite: contact deletion hook should be called before, not after physical contact deletion
-rwxr-xr-x | plugins/Dbx_sqlite/src/dbcontacts.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
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; |