r3263 - in trunk/libmsip: include/libmsip source source/dialogs
svn at minisip.org
svn at minisip.org
Wed May 9 13:58:42 CEST 2007
Author: erik
Date: 2007-04-27 16:34:15 +0200 (Fri, 27 Apr 2007)
New Revision: 3263
Modified:
trunk/libmsip/include/libmsip/SipDialog.h
trunk/libmsip/source/SipLayerDialog.cxx
trunk/libmsip/source/dialogs/SipDialog.cxx
Log:
* libmsip: Fix memory leak: Break reference loops in SipDialog objects
when they are removed from the SIP stack.
Also, add support for a "free" method in SipDialog objects
in case there are reference loops on the TU layer that
needs to be solved (we don't have such problems in minisip).
Modified: trunk/libmsip/include/libmsip/SipDialog.h
===================================================================
--- trunk/libmsip/include/libmsip/SipDialog.h 2007-04-27 11:57:39 UTC (rev 3262)
+++ trunk/libmsip/include/libmsip/SipDialog.h 2007-04-27 14:34:15 UTC (rev 3263)
@@ -133,6 +133,16 @@
* Deconstructor.
*/
virtual ~SipDialog();
+
+ /**
+ * This method is called when the SIP stack removes a
+ * terminated dialog. The default behavour is to do
+ * nothing.
+ *
+ * Typical use is to override this method to implement
+ * clean up code.
+ */
+ virtual void free();
virtual std::string getMemObjectType() const {return "SipDialog";}
Modified: trunk/libmsip/source/SipLayerDialog.cxx
===================================================================
--- trunk/libmsip/source/SipLayerDialog.cxx 2007-04-27 11:57:39 UTC (rev 3262)
+++ trunk/libmsip/source/SipLayerDialog.cxx 2007-04-27 14:34:15 UTC (rev 3263)
@@ -57,6 +57,11 @@
}
bool SipLayerDialog::removeDialog(string callId){
+ MRef<SipDialog*> d = dialogs[callId];
+ if (d){
+ d->free();
+ d->freeStateMachine();
+ }
size_t n = dialogs.erase(callId);
#ifdef DEBUG_OUTPUT
if (n!=1){
@@ -87,7 +92,6 @@
#ifdef DEBUG_OUTPUT
mdbg<< "SipLayerDialog: got command: "<< c <<end;
#endif
- cerr << "EEEE: command: "<< c << endl;
string cid = c.getDestinationId();
Modified: trunk/libmsip/source/dialogs/SipDialog.cxx
===================================================================
--- trunk/libmsip/source/dialogs/SipDialog.cxx 2007-04-27 11:57:39 UTC (rev 3262)
+++ trunk/libmsip/source/dialogs/SipDialog.cxx 2007-04-27 14:34:15 UTC (rev 3263)
@@ -79,6 +79,9 @@
}
+void SipDialog::free(){
+}
+
MRef<SipDialogConfig*> SipDialog::getDialogConfig(){
return callConfig;
}
More information about the Minisip-devel
mailing list