Module: sems Branch: master Commit: c377a71c556a72afd72e400e0e60c6bf53a2a486 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=c377a71c556a72afd72e400e0e60c6bf53a2a486
Author: Stefan Sayer <[email protected]> Committer: Stefan Sayer <[email protected]> Date: Tue Nov 8 01:43:03 2011 +0100 b/f: fix transferOwnership for SystemDSM (e.g. for python code) --- apps/dsm/SystemDSM.cpp | 15 +++++++++++++-- apps/dsm/SystemDSM.h | 3 +++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/apps/dsm/SystemDSM.cpp b/apps/dsm/SystemDSM.cpp index ae2dc08..5820276 100644 --- a/apps/dsm/SystemDSM.cpp +++ b/apps/dsm/SystemDSM.cpp @@ -27,6 +27,9 @@ SystemDSM::SystemDSM(const DSMScriptConfig& config, } SystemDSM::~SystemDSM() { + for (std::set<DSMDisposable*>::iterator it= + gc_trash.begin(); it != gc_trash.end(); it++) + delete *it; } void SystemDSM::run() { @@ -141,6 +144,16 @@ void SystemDSM::process(AmEvent* event) { } + /** transfer ownership of object to this session instance */ +void SystemDSM::transferOwnership(DSMDisposable* d) { + gc_trash.insert(d); +} + + /** release ownership of object from this session instance */ +void SystemDSM::releaseOwnership(DSMDisposable* d) { + gc_trash.erase(d); +} + #define NOT_IMPLEMENTED(_func) \ void SystemDSM::_func { \ throw DSMException("core", "cause", "not implemented"); \ @@ -179,8 +192,6 @@ NOT_IMPLEMENTED(B2BaddReceivedRequest(const AmSipRequest& req)); NOT_IMPLEMENTED(B2BsetHeaders(const string& hdr, bool replaceCRLF)); NOT_IMPLEMENTED(B2BclearHeaders()); NOT_IMPLEMENTED(B2BaddHeader(const string& hdr)); -NOT_IMPLEMENTED(transferOwnership(DSMDisposable* d)); -NOT_IMPLEMENTED(releaseOwnership(DSMDisposable* d)); #undef NOT_IMPLEMENTED #undef NOT_IMPLEMENTED_UINT diff --git a/apps/dsm/SystemDSM.h b/apps/dsm/SystemDSM.h index cb8b2eb..ba32eed 100644 --- a/apps/dsm/SystemDSM.h +++ b/apps/dsm/SystemDSM.h @@ -38,6 +38,9 @@ class SystemDSM string startDiagName; bool reload; + // owned by this instance + std::set<DSMDisposable*> gc_trash; + public: SystemDSM(const DSMScriptConfig& config, _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
