Merge pull request #4853
2b3595d0
various: do not propagate exception through dtor (moneromooo-monero)
This commit is contained in:
commit
398f7076bb
|
@ -73,7 +73,7 @@ namespace epee
|
||||||
mlocked(const T &&t): T(t) { mlocker::lock(this, sizeof(T)); }
|
mlocked(const T &&t): T(t) { mlocker::lock(this, sizeof(T)); }
|
||||||
mlocked(const mlocked<T> &&mt): T(mt) { mlocker::lock(this, sizeof(T)); }
|
mlocked(const mlocked<T> &&mt): T(mt) { mlocker::lock(this, sizeof(T)); }
|
||||||
mlocked<T> &operator=(const mlocked<T> &mt) { T::operator=(mt); return *this; }
|
mlocked<T> &operator=(const mlocked<T> &mt) { T::operator=(mt); return *this; }
|
||||||
~mlocked() { mlocker::unlock(this, sizeof(T)); }
|
~mlocked() { try { mlocker::unlock(this, sizeof(T)); } catch (...) { /* do not propagate */ } }
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|
|
@ -108,7 +108,8 @@ namespace epee
|
||||||
|
|
||||||
mlocker::~mlocker()
|
mlocker::~mlocker()
|
||||||
{
|
{
|
||||||
unlock(ptr, len);
|
try { unlock(ptr, len); }
|
||||||
|
catch (...) { /* ignore and do not propagate through the dtor */ }
|
||||||
}
|
}
|
||||||
|
|
||||||
void mlocker::lock(void *ptr, size_t len)
|
void mlocker::lock(void *ptr, size_t len)
|
||||||
|
|
|
@ -55,7 +55,8 @@ public:
|
||||||
{
|
{
|
||||||
if (m_ok)
|
if (m_ok)
|
||||||
{
|
{
|
||||||
mp_http_client->disconnect();
|
try { mp_http_client->disconnect(); }
|
||||||
|
catch (...) { /* do not propagate through dtor */ }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -830,7 +830,12 @@ wallet_keys_unlocker::~wallet_keys_unlocker()
|
||||||
{
|
{
|
||||||
if (!locked)
|
if (!locked)
|
||||||
return;
|
return;
|
||||||
w.encrypt_keys(key);
|
try { w.encrypt_keys(key); }
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
MERROR("Failed to re-encrypt wallet keys");
|
||||||
|
// do not propagate through dtor, we'd crash
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wallet2::wallet2(network_type nettype, uint64_t kdf_rounds, bool unattended):
|
wallet2::wallet2(network_type nettype, uint64_t kdf_rounds, bool unattended):
|
||||||
|
|
Loading…
Reference in New Issue