[EMAIL PROTECTED] wrote:
> [EMAIL PROTECTED] wrote:
>> More leak fixes are in the attachment.
>> wxCommunicator can reinitialize sipxtapi during runtime so they manifest
>> themselves.
>>
>> Jaroslav Libak
>>
>>

One more fix. This one fixes a leak of timers during uninitialization.
Timers weren't deleted because deleteTimers required them to be running.
But in SipUserAgent we stop all transaction timers when we receive
message to shut it down. Then we call
SipTransactionList::deleteTransactionTimers which doesn't delete the
timers. Timers arent deleted in handle message as the author of
deleteTimers assumed in this case. But for
SipTransaction::~SipTransaction where we also call deleteTimers we dont
want to delete timers if they are stopped. So I added a new parameter to
deleteTimers to differentiate between these 2 cases.

Jaroslav Libak

Index: include/net/SipTransaction.h
===================================================================
--- include/net/SipTransaction.h        (revision 9091)
+++ include/net/SipTransaction.h        (working copy)
@@ -145,7 +145,7 @@
 
     void stopTimers() ;
     void startTimers();
-    void deleteTimers();
+    void deleteTimers(bool bForcedDeletion = false);
 
 /* ============================ Deprecated ============================== */
 
Index: src/net/SipTransaction.cpp
===================================================================
--- src/net/SipTransaction.cpp  (revision 9091)
+++ src/net/SipTransaction.cpp  (working copy)
@@ -3962,7 +3962,7 @@
     }
 }
 
-void SipTransaction::deleteTimers()
+void SipTransaction::deleteTimers(bool bForcedDeletion /*= false*/)
 {
     UtlSListIterator iterator(mTimers);
     OsTimer* timer = NULL;
@@ -3977,7 +3977,9 @@
         // Only delete the timer if not stopped -- the timer will be cleaned 
         // up in handle message.  Delete it opens up a race (the timer could
         // be queued up on the SipUserAgent already).
-        if (timer->getState() != OsTimer::STOPPED)
+
+        // bForcedDeletion is true when it is safe to delete timer here
+        if (bForcedDeletion || timer->getState() != OsTimer::STOPPED)
         {
             timer->stop();
             SipMessageEvent* pMsgEvent = (SipMessageEvent*) 
timer->getUserData() ;
Index: src/net/SipTransactionList.cpp
===================================================================
--- src/net/SipTransactionList.cpp      (revision 9091)
+++ src/net/SipTransactionList.cpp      (working copy)
@@ -357,7 +357,7 @@
 
         while((transactionFound = (SipTransaction*) iterator()))
         {
-            transactionFound->deleteTimers();
+            transactionFound->deleteTimers(true);
         }
     }
 
_______________________________________________
sipxtapi-dev mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipxtapi-dev/

Reply via email to