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/cloak_custom.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'modules/cloak_custom.cpp') diff --git a/modules/cloak_custom.cpp b/modules/cloak_custom.cpp index 70a68cf0b..0b4366482 100644 --- a/modules/cloak_custom.cpp +++ b/modules/cloak_custom.cpp @@ -30,7 +30,7 @@ public: Cloak::API cloakapi; Cloak::Engine& customcloak; - CustomCloakExtItem(Module* mod, Cloak::Engine& cloak) + CustomCloakExtItem(const WeakModulePtr& mod, Cloak::Engine& cloak) : SimpleExtItem(mod, "custom-cloak", ExtensionType::USER, true) , cloakapi(mod) , customcloak(cloak) @@ -128,7 +128,7 @@ private: public: CloakAccounts accounts; - CommandCustomCloak(Module* mod, CustomCloakExtItem& ext) + CommandCustomCloak(const WeakModulePtr& mod, CustomCloakExtItem& ext) : SplitCommand(mod, "CUSTOMCLOAK", 2) , cloakext(ext) , cloakmode(mod, "cloak") @@ -238,7 +238,7 @@ class CustomEngine final public: CustomCloakExtItem customcloakext; - CustomEngine(Module* mod) + CustomEngine(const WeakModulePtr& mod) : Cloak::Engine(mod, "custom") , customcloakext(mod, *this) { @@ -263,8 +263,8 @@ private: public: ModuleCloakCustom() : Module(VF_VENDOR, "Adds the custom cloaking method for use with the cloak module.") - , cmdcustomcloak(this, customcloak.customcloakext) - , customcloak(this) + , cmdcustomcloak(weak_from_this(), customcloak.customcloakext) + , customcloak(weak_from_this()) { } @@ -275,19 +275,19 @@ public: { const auto name = tag->getString("name"); if (name.empty()) - throw ModuleException(this, " must not be empty, at " + tag->source.str()); + throw ModuleException(weak_from_this(), " must not be empty, at " + tag->source.str()); const auto password = tag->getString("password"); if (password.empty()) - throw ModuleException(this, " must not be empty, at " + tag->source.str()); + throw ModuleException(weak_from_this(), " must not be empty, at " + tag->source.str()); Cloak::Info cloak(tag->getString("username"), tag->getString("hostname")); if (cloak.hostname.empty()) - throw ModuleException(this, " must not be empty, at " + tag->source.str()); + throw ModuleException(weak_from_this(), " must not be empty, at " + tag->source.str()); CloakAccount account(tag, cloak, password); if (!newaccounts.emplace(name, account).second) - throw ModuleException(this, " (" + name + ") used in multiple tags, at " + tag->source.str()); + throw ModuleException(weak_from_this(), " (" + name + ") used in multiple tags, at " + tag->source.str()); } std::swap(newaccounts, cmdcustomcloak.accounts); } -- cgit v1.3.1-10-gc9f91