aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-05-24 15:15:02 +0200
committerGitHub <[email protected]>2023-05-24 15:15:02 +0200
commitc69b7341838f86f73519e20b83996b609cda7f6c (patch)
tree394a00b17814c943059513f4781065c236753d3b /src
parentcache log sessionid (#297) (diff)
downloadzen-c69b7341838f86f73519e20b83996b609cda7f6c.tar.xz
zen-c69b7341838f86f73519e20b83996b609cda7f6c.zip
block destructors from throwing exceptions (#321)
* ~FileMapping() is not allowed to throw exceptions * ~ScopedActivityBase() should not call ZEN_ASSERT (which causes SIGABORT on error) * ProjectStore::Project::WriteAccessTimes() which is called from ProjectStore::~Project() must not throw exceptions * changelog
Diffstat (limited to 'src')
-rw-r--r--src/zencore/include/zencore/windows.h4
-rw-r--r--src/zencore/logging.cpp6
-rw-r--r--src/zenserver/projectstore/projectstore.cpp10
3 files changed, 12 insertions, 8 deletions
diff --git a/src/zencore/include/zencore/windows.h b/src/zencore/include/zencore/windows.h
index 333188cb3..6c238f845 100644
--- a/src/zencore/include/zencore/windows.h
+++ b/src/zencore/include/zencore/windows.h
@@ -252,7 +252,7 @@ public:
m_hMapping = NULL;
}
- ~FileMapping() throw() { Unmap(); }
+ ~FileMapping() noexcept(true) { Unmap(); }
HRESULT MapFile(_In_ HANDLE hFile,
_In_ SIZE_T nMappingSize = 0,
@@ -372,7 +372,7 @@ public:
return S_OK;
}
- HRESULT Unmap() throw()
+ HRESULT Unmap() noexcept(true)
{
HRESULT hr = S_OK;
diff --git a/src/zencore/logging.cpp b/src/zencore/logging.cpp
index 07b379cba..dc923f45e 100644
--- a/src/zencore/logging.cpp
+++ b/src/zencore/logging.cpp
@@ -131,7 +131,11 @@ ScopedActivityBase::ScopedActivityBase() : m_NextScope{t_ScopeStack}
ScopedActivityBase::~ScopedActivityBase()
{
- ZEN_ASSERT(t_ScopeStack == this);
+ if (t_ScopeStack != this)
+ {
+ ZEN_ERROR("invalid t_ScopeStack in ~ScopedActivityBase(). Expected {:#x}, found {:#x}", (uintptr_t)this, (uintptr_t)t_ScopeStack);
+ return;
+ }
t_ScopeStack = m_NextScope;
}
diff --git a/src/zenserver/projectstore/projectstore.cpp b/src/zenserver/projectstore/projectstore.cpp
index 4b0c801bc..deae58508 100644
--- a/src/zenserver/projectstore/projectstore.cpp
+++ b/src/zenserver/projectstore/projectstore.cpp
@@ -1144,14 +1144,14 @@ ProjectStore::Project::WriteAccessTimes()
Writer.Save(Mem);
- CreateDirectories(m_OplogStoragePath);
+ try
+ {
+ CreateDirectories(m_OplogStoragePath);
- std::filesystem::path ProjectAccessTimesFilePath = m_OplogStoragePath / "AccessTimes.zcb"sv;
+ std::filesystem::path ProjectAccessTimesFilePath = m_OplogStoragePath / "AccessTimes.zcb"sv;
- ZEN_INFO("persisting access times for project '{}' to {}", Identifier, ProjectAccessTimesFilePath);
+ ZEN_INFO("persisting access times for project '{}' to {}", Identifier, ProjectAccessTimesFilePath);
- try
- {
BasicFile Blob;
Blob.Open(ProjectAccessTimesFilePath, BasicFile::Mode::kTruncate);
Blob.Write(Mem.Data(), Mem.Size(), 0);