In sipxtapi in function sipxUnInitialize we delete SipUserAgent after LineManager which is the wrong way. SipUserAgent is deleted in pCallManager destructor. Then a packet arrives, LineManager is gone and SipUserAgent tries to access line mutex.

listMutex.acquire();

in
    msvcr80d.dll!_NMSG_WRITE(int rterrnum=25)  Line 198    C
    msvcr80d.dll!_purecall()  Line 54 + 0x7 bytes    C
> sipXtapid.dll!OsLockingList::getIteratorHandle() Line 101 + 0x18 bytes C++ sipXtapid.dll!SipLineList::findLine(const char * lineId=0x0232cd94, const char * realm=0x0232c760, const Url & toFromUrl={...}, const char * userId=0x0232c8d4, const Url & defaultLine={...}) Line 303 + 0xb bytes C++ sipXtapid.dll!SipLineMgr::getLineforAuthentication(const SipMessage * request=0x02f41ee8, const SipMessage * response=0x01755250, const int & isIncomingRequest=0, const int & fromTempList=1) Line 630 + 0x43 bytes C++ sipXtapid.dll!SipLineMgr::buildAuthenticatedRequest(const SipMessage * response=0x01755250, const SipMessage * request=0x02f41ee8, SipMessage * newAuthRequest=0x02f458b0) Line 800 + 0x32 bytes C++ sipXtapid.dll!SipUserAgent::resendWithAuthorization(SipMessage * response=0x01755250, SipMessage * request=0x02f41ee8, int * messageType=0x0232f720, int authorizationEntity=0) Line 4046 + 0x29 bytes C++ sipXtapid.dll!SipUserAgent::dispatch(SipMessage * message=0x02f36b80, int messageType=0, SIPX_TRANSPORT_DATA * pTransport=0x00000000) Line 1804 + 0x1c bytes C++ sipXtapid.dll!SipClient::run(void * runArg=0x00000000) Line 469 + 0x2b bytes C++ sipXtapid.dll!OsTaskWnt::threadEntry(void * arg=0x01784710) Line 587 + 0x26 bytes C++


It needs to look like this:

delete pInst->pSipUserAgent;
delete pInst->pLineManager; delete pInst->pCallManager;

Then it doesn't crash. Also remove delete SipUserAgent from CallManager destructor since we do it now.
Patch is in attachments.

Issue = XCL-123

Jaro

diff -ru old/sipXcallLib/src/cp/CallManager.cpp 
new/sipXcallLib/src/cp/CallManager.cpp
--- old/sipXcallLib/src/cp/CallManager.cpp      Tue Feb 13 17:59:31 2007
+++ new/sipXcallLib/src/cp/CallManager.cpp      Tue Feb 13 17:35:15 2007
@@ -307,11 +307,6 @@
     }
 
     waitUntilShutDown();   
-    if(sipUserAgent)
-    {
-        delete sipUserAgent;
-        sipUserAgent = NULL;
-    }
 
     if (mMaxNumListeners > 0)  // check if listener exists.
     {
diff -ru old/sipXcallLib/src/tapi/sipXtapi.cpp 
new/sipXcallLib/src/tapi/sipXtapi.cpp
--- old/sipXcallLib/src/tapi/sipXtapi.cpp       Tue Feb 13 18:00:09 2007
+++ new/sipXcallLib/src/tapi/sipXtapi.cpp       Tue Feb 13 17:35:33 2007
@@ -694,13 +694,14 @@
             
             // First: Shutdown user agent to avoid processing during teardown
             pInst->pSipUserAgent->shutdown(TRUE) ;
+            pInst->pSipUserAgent->requestShutdown();
 
             // get rid of pointer to the line manager in the refresh manager
             pInst->pRefreshManager->setLineMgr(NULL);
             pInst->pLineManager->requestShutdown();
             pInst->pCallManager->requestShutdown();
             pInst->pRefreshManager->requestShutdown();
-            pInst->pSipUserAgent->requestShutdown();
             pInst->pSubscribeClient->requestShutdown();
             pInst->pSubscribeServer->requestShutdown();
             pInst->pSipRefreshManager->requestShutdown();
@@ -716,8 +717,9 @@
             delete pInst->pRefreshManager ;
             delete pInst->pSipRefreshManager ;
             delete pInst->pDialogManager ;
+            delete pInst->pSipUserAgent;
             delete pInst->pLineManager;            
-            delete pInst->pCallManager; // Deletes SipUserAgent
+            delete pInst->pCallManager;
             delete pInst->pCodecFactory;            
 
             sipxDestroyMediaFactoryFactory() ;
_______________________________________________
sipxtapi-dev mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipxtapi-dev/

Reply via email to