summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mdbx/src/stdafx.h
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-11-17 22:04:39 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-11-17 22:04:39 +0300
commite1721a9474dc2906771e6c98ada72d41854ce5a9 (patch)
treecffab9a2252165ad5285ba4af1eee8e575a8966c /plugins/Dbx_mdbx/src/stdafx.h
parentd5df87b152c42caadd2f41bd2712663caf4bd4e2 (diff)
fixes #2569 (Ломается профиль после ребута компа. Miranda NG не может открыть '*', профиль в неизвестном формате)
Diffstat (limited to 'plugins/Dbx_mdbx/src/stdafx.h')
-rw-r--r--plugins/Dbx_mdbx/src/stdafx.h56
1 files changed, 16 insertions, 40 deletions
diff --git a/plugins/Dbx_mdbx/src/stdafx.h b/plugins/Dbx_mdbx/src/stdafx.h
index 0dcad889ed..82e2e8be53 100644
--- a/plugins/Dbx_mdbx/src/stdafx.h
+++ b/plugins/Dbx_mdbx/src/stdafx.h
@@ -58,46 +58,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# define thread_local __declspec(thread)
#endif
-class txn_ptr
-{
- MDBX_txn *txn;
-public:
- __forceinline txn_ptr(MDBX_txn *_txn) :
- txn(_txn)
- {}
-
- __forceinline ~txn_ptr()
- {
- if (txn) {
- /* FIXME: see https://github.com/leo-yuriev/libfpta/blob/77a7251fde2030165a3916ee68fd86a1374b3dd8/src/common.cxx#L370 */
- Abort();
- }
- }
-
- __forceinline operator MDBX_txn*() const { return txn; }
-
- __forceinline int Commit()
- {
- int rc = mdbx_txn_commit(txn);
- if (rc != MDBX_SUCCESS) {
- /* FIXME: throw an exception */
- Abort();
- return rc;
- }
- txn = nullptr;
- return MDBX_SUCCESS;
- }
-
- __forceinline void Abort()
- {
- int rc = mdbx_txn_abort(txn);
- /* FIXME: throw an exception */
- _ASSERT(rc == MDBX_SUCCESS);
- UNREFERENCED_PARAMETER(rc);
- txn = nullptr;
- }
-};
-
struct CMDBX_txn_ro
{
MDBX_txn *txn = nullptr;
@@ -140,6 +100,22 @@ public:
};
#include "dbintf.h"
+
+class txn_ptr
+{
+ CDbxMDBX *pDb;
+ MDBX_txn *txn;
+
+public:
+ txn_ptr(CDbxMDBX *_db);
+ ~txn_ptr();
+
+ __forceinline operator MDBX_txn*() const { return txn; }
+
+ int Commit();
+ void Abort();
+};
+
#include "resource.h"
#include "version.h"