diff options
| author | Dan Engelbrecht <[email protected]> | 2023-04-27 14:18:18 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-04-27 14:18:18 +0200 |
| commit | e6a82b1438dce4e62f605ee74cf8e1d6c932d59c (patch) | |
| tree | 60be84d99f1fe4eec94d13c73f0c1a25119c312a /zencore/include | |
| parent | v0.2.7 (diff) | |
| download | zen-e6a82b1438dce4e62f605ee74cf8e1d6c932d59c.tar.xz zen-e6a82b1438dce4e62f605ee74cf8e1d6c932d59c.zip | |
bugfixes (#261)
* Don't try to GC if now blocks to GC was found, regardless if we have locations in memory
* Don't let exception leak from scope guard as throw in destructor will abort application
* changelog
Diffstat (limited to 'zencore/include')
| -rw-r--r-- | zencore/include/zencore/scopeguard.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/zencore/include/zencore/scopeguard.h b/zencore/include/zencore/scopeguard.h index 13fed4ac5..d04c8ed9c 100644 --- a/zencore/include/zencore/scopeguard.h +++ b/zencore/include/zencore/scopeguard.h @@ -3,6 +3,7 @@ #pragma once #include <type_traits> +#include "logging.h" #include "zencore.h" namespace zen { @@ -15,7 +16,16 @@ public: ~ScopeGuardImpl() { if (!m_dismissed) - m_guardFunc(); + { + try + { + m_guardFunc(); + } + catch (std::exception& Ex) + { + ZEN_ERROR("scope guard threw exception: '{}'", Ex.what()); + } + } } void Dismiss() { m_dismissed = true; } |