From cbc5431d62e3fe9166f18395dce3ddf2af0906d3 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sat, 28 Mar 2026 21:32:23 +0000 Subject: Switch modules from reference<> to shared_ptr<> and weak_ptr<>. --- modules/extra/ldap.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'modules/extra/ldap.cpp') diff --git a/modules/extra/ldap.cpp b/modules/extra/ldap.cpp index 14cb433e7..8ace946ec 100644 --- a/modules/extra/ldap.cpp +++ b/modules/extra/ldap.cpp @@ -360,7 +360,7 @@ public: query_queue queries, results; std::mutex process_mutex; /* held when processing requests not in either queue */ - LDAPService(Module* c, const std::shared_ptr& tag) + LDAPService(const WeakModulePtr& c, const std::shared_ptr& tag) : LDAPProvider(c, tag->getString("id")) , config(tag) { @@ -632,7 +632,7 @@ public: ServiceMap::iterator curr = LDAPServices.find(id); if (curr == LDAPServices.end()) { - auto* conn = new LDAPService(this, tag); + auto* conn = new LDAPService(weak_from_this(), tag); conns[id] = conn; ServerInstance->Modules.AddService(*conn); @@ -656,7 +656,7 @@ public: LDAPServices.swap(conns); } - void OnUnloadModule(Module* m) override + void OnUnloadModule(const ModulePtr& m) override { for (const auto& [_, s] : LDAPServices) { @@ -668,7 +668,7 @@ public: LDAPRequest* req = s->queries[i - 1]; LDAPInterface* li = req->inter; - if (li->creator == m) + if (insp::same_ptr(li->creator, m)) { s->queries.erase(s->queries.begin() + i - 1); delete req; @@ -680,7 +680,7 @@ public: LDAPRequest* req = s->results[i - 1]; LDAPInterface* li = req->inter; - if (li->creator == m) + if (insp::same_ptr(li->creator, m)) { s->results.erase(s->results.begin() + i - 1); delete req; -- cgit v1.3.1-10-gc9f91