diff --git a/modules/modperl/modperl.i b/modules/modperl/modperl.i index 739799a8..fbfc4c26 100644 --- a/modules/modperl/modperl.i +++ b/modules/modperl/modperl.i @@ -242,7 +242,7 @@ typedef std::vector > VPair; %inline %{ TWebSubPage _CreateWebSubPage(const CString& sName, const CString& sTitle, const VPair& vParams, unsigned int uFlags) { - return new CWebSubPage(sName, sTitle, vParams, uFlags); + return std::make_shared(sName, sTitle, vParams, uFlags); } %} diff --git a/modules/modpython/codegen.pl b/modules/modpython/codegen.pl index 39c6c97c..b0729756 100755 --- a/modules/modpython/codegen.pl +++ b/modules/modpython/codegen.pl @@ -292,7 +292,7 @@ while (<$in>) { say $out "Py_BuildValue(\"l\", (long int)$a->{var});"; } } - when (/^CSmartPtr/) { + when (/^std::shared_ptr/) { say $out "SWIG_NewInstanceObj(new $a->{type}($a->{var}), SWIG_TypeQuery(\"$a->{type}*\"), SWIG_POINTER_OWN);"; } when (/\*$/) { diff --git a/modules/modpython/functions.in b/modules/modpython/functions.in index 4a9e17e3..5bf893d2 100644 --- a/modules/modpython/functions.in +++ b/modules/modpython/functions.in @@ -78,4 +78,4 @@ EModRet OnModuleUnloading(CModule* pModule, bool& bSuccess, CString& sRetMsg) EModRet OnGetModInfo(CModInfo& ModInfo, const CString& sModule, bool& bSuccess, CString& sRetMsg) void OnGetAvailableMods(std::set& ssMods, CModInfo::EModuleType eType) void OnClientCapLs(CClient* pClient, SCString& ssCaps) -EModRet OnLoginAttempt(CSmartPtr Auth) +EModRet OnLoginAttempt(std::shared_ptr Auth) diff --git a/modules/modpython/modpython.i b/modules/modpython/modpython.i index 8495d09a..1fc8899b 100644 --- a/modules/modpython/modpython.i +++ b/modules/modpython/modpython.i @@ -58,6 +58,7 @@ using std::allocator; %include %include %include +%include %include "modpython/cstring.i" %template(_stringlist) std::list; @@ -129,8 +130,8 @@ class MCString : public std::map {}; %include "../include/znc/defines.h" %include "../include/znc/Utils.h" %include "../include/znc/Threads.h" -%template(PAuthBase) CSmartPtr; -%template(WebSession) CSmartPtr; +%template(PAuthBase) std::shared_ptr; +%template(WebSession) std::shared_ptr; %include "../include/znc/Config.h" %include "../include/znc/Csocket.h" %template(ZNCSocketManager) TSocketManager; @@ -308,7 +309,7 @@ typedef std::vector > VPair; %inline %{ TWebSubPage CreateWebSubPage_(const CString& sName, const CString& sTitle, const VPair& vParams, unsigned int uFlags) { - return new CWebSubPage(sName, sTitle, vParams, uFlags); + return std::make_shared(sName, sTitle, vParams, uFlags); } %} diff --git a/modules/modpython/module.h b/modules/modpython/module.h index 2a4e265b..3a8dd46a 100644 --- a/modules/modpython/module.h +++ b/modules/modpython/module.h @@ -137,7 +137,7 @@ public: bool& bSuccess, CString& sRetMsg); virtual void OnGetAvailableMods(std::set& ssMods, CModInfo::EModuleType eType); virtual void OnClientCapLs(CClient* pClient, SCString& ssCaps); - virtual EModRet OnLoginAttempt(CSmartPtr Auth); + virtual EModRet OnLoginAttempt(std::shared_ptr Auth); }; static inline CPyModule* AsPyModule(CModule* p) {