From ff813ebea6e4c65120bc3806252bfbafdedd8e00 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 26 Sep 2019 10:41:21 -0700 Subject: [PATCH] ircd::mods: Fix missing reference count condition for children on unload(). (closes #109) --- ircd/mods.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ircd/mods.cc b/ircd/mods.cc index 6a7d3b1b7..18244eca9 100644 --- a/ircd/mods.cc +++ b/ircd/mods.cc @@ -97,7 +97,8 @@ ircd::mods::unload(mod &mod) (auto *const &ptr) { assert(ptr); - return shared_from(*ptr); + const auto ret(shared_from(*ptr)); + return ret.use_count() > 2? ret : std::shared_ptr{}; }); // Call the user's unloading function here.