summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mdbx
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-07-18 21:52:22 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-07-18 21:52:22 +0300
commit6fa77048dee795a3df01ce8a6ae023360822756c (patch)
treeefebc3f0f40ce10c766c39dddc4f3ad7466c1fb0 /plugins/Dbx_mdbx
parent9aeb9578d8e264d4b351b597f20dc1cd7e86b278 (diff)
no need to crash inside assert in runtime
Diffstat (limited to 'plugins/Dbx_mdbx')
-rw-r--r--plugins/Dbx_mdbx/src/dbintf.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/plugins/Dbx_mdbx/src/dbintf.cpp b/plugins/Dbx_mdbx/src/dbintf.cpp
index 9c659c5593..4883c936d0 100644
--- a/plugins/Dbx_mdbx/src/dbintf.cpp
+++ b/plugins/Dbx_mdbx/src/dbintf.cpp
@@ -235,6 +235,15 @@ STDMETHODIMP_(void) CDbxMDBX::SetCacheSafetyMode(BOOL bIsSet)
/////////////////////////////////////////////////////////////////////////////////////////
+static void assert_func(const MDBX_env*, const char *msg, const char *function, unsigned line)
+{
+ Netlib_Logf(nullptr, "MDBX: assertion failed (%s, %d): %s", function, line, msg);
+
+ #if defined(_DEBUG)
+ _wassert(_A2T(msg), _A2T(function), line);
+ #endif
+}
+
int CDbxMDBX::Map()
{
if (!LockName(m_tszProfileName))
@@ -244,6 +253,7 @@ int CDbxMDBX::Map()
mdbx_env_set_maxdbs(m_env, 10);
mdbx_env_set_maxreaders(m_env, 244);
mdbx_env_set_userctx(m_env, this);
+ mdbx_env_set_assert(m_env, assert_func);
#ifdef _WIN64
__int64 upperLimit = 0x400000000ul;