summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mdbx/src/dbsettings.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-12-07 12:42:40 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-12-07 12:42:40 +0300
commit8343b85b097da18cc7d4b17e598f2d5a9003a7fe (patch)
tree026e2c362823835d1949c1b2b97ac5df12f05790 /plugins/Dbx_mdbx/src/dbsettings.cpp
parent8a557bb6c7119e9a8d196d76e144727b1b861c1d (diff)
useless code removed
Diffstat (limited to 'plugins/Dbx_mdbx/src/dbsettings.cpp')
-rw-r--r--plugins/Dbx_mdbx/src/dbsettings.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/plugins/Dbx_mdbx/src/dbsettings.cpp b/plugins/Dbx_mdbx/src/dbsettings.cpp
index ba8804afdc..523d7a4801 100644
--- a/plugins/Dbx_mdbx/src/dbsettings.cpp
+++ b/plugins/Dbx_mdbx/src/dbsettings.cpp
@@ -353,9 +353,6 @@ BOOL CDbxMDBX::WriteContactSetting(MCONTACT contactID, DBCONTACTWRITESETTING *db
txn_ptr trnlck(this);
if (mdbx_put(trnlck, m_dbSettings, &key, &data, MDBX_UPSERT) != MDBX_SUCCESS)
return 1;
-
- if (trnlck.Commit() != MDBX_SUCCESS)
- return 1;
}
// notify
@@ -377,8 +374,8 @@ BOOL CDbxMDBX::DeleteContactSetting(MCONTACT contactID, LPCSTR szModule, LPCSTR
mir_cslock lck(m_csDbAccess);
char *szCachedSettingName = m_cache->GetCachedSetting(szModule, szSetting, moduleNameLen, settingNameLen);
- if (szCachedSettingName[-1] == 0) // it's not a resident variable
- {
+ // it's not a resident variable, delete it from database too
+ if (szCachedSettingName[-1] == 0) {
DBSettingKey *keyVal = (DBSettingKey*)_alloca(sizeof(DBSettingKey) + settingNameLen);
keyVal->hContact = contactID;
keyVal->dwModuleId = GetModuleID(szModule);
@@ -388,15 +385,13 @@ BOOL CDbxMDBX::DeleteContactSetting(MCONTACT contactID, LPCSTR szModule, LPCSTR
MDBX_val key = { keyVal, sizeof(DBSettingKey) + settingNameLen };
if (mdbx_del(trnlck, m_dbSettings, &key, nullptr) != MDBX_SUCCESS)
return 1;
- if (trnlck.Commit() != MDBX_SUCCESS)
- return 1;
+ DBFlush();
}
+ // and don't forget to remove it from cache
m_cache->GetCachedValuePtr(contactID, szCachedSettingName, -1);
}
- DBFlush();
-
// notify
DBCONTACTWRITESETTING dbcws = { 0 };
dbcws.szModule = szModule;