aboutsummaryrefslogtreecommitdiffstats
path: root/src/cull.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2023-07-05 14:57:00 +0100
committerGravatar Sadie Powell2023-07-05 15:04:11 +0100
commit3443c4c561db8fe48edb12ab1407a32206ffe054 (patch)
tree6812b55831ef485794ebb0786f45a1fb927dcd34 /src/cull.cpp
parentAvoid culling DLLManager instances twice. (diff)
downloadinspircd++-3443c4c561db8fe48edb12ab1407a32206ffe054.tar.gz
inspircd++-3443c4c561db8fe48edb12ab1407a32206ffe054.tar.bz2
inspircd++-3443c4c561db8fe48edb12ab1407a32206ffe054.zip
Restore the double container logic in CullList::Apply.
Unfortunately we can't just use a set here as some cullable objects need to be deleted in the order they were culled.
Diffstat (limited to 'src/cull.cpp')
-rw-r--r--src/cull.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/cull.cpp b/src/cull.cpp
index d8b645dc2..e07bc036b 100644
--- a/src/cull.cpp
+++ b/src/cull.cpp
@@ -80,6 +80,7 @@ void CullList::Apply()
}
std::unordered_set<Cullable*> culled;
+ std::vector<Cullable*> deletable;
culled.reserve(list.size() + 32);
// IMPORTANT: we can't use a range-based for loop here as culling an object
@@ -94,6 +95,10 @@ void CullList::Apply()
fmt::ptr(c));
#endif
c->Cull();
+
+ // IMPORTANT: we have to use two containers here because some objects
+ // have to be deleted in the same order they were culled in.
+ deletable.push_back(c);
}
else
{
@@ -108,7 +113,7 @@ void CullList::Apply()
}
list.clear();
- for (auto* c : culled)
+ for (auto* c : deletable)
{
#ifdef INSPIRCD_ENABLE_RTTI
ServerInstance->Logs.Debug("CULLLIST", "Deleting {} @{}", typeid(*c).name(),