diff -r 35c06c1d4fa6 -r 07656293a99c datacommsserver/esockserver/ssock/ss_connselect.cpp --- a/datacommsserver/esockserver/ssock/ss_connselect.cpp Wed Jun 09 11:00:38 2010 +0300 +++ b/datacommsserver/esockserver/ssock/ss_connselect.cpp Mon Jun 21 17:02:22 2010 +0300 @@ -131,11 +131,10 @@ { RNodeInterface::OpenPostMessageClose(Id(), aSender, TEChild::TLeft().CRef()); iActiveRequests[idx].SetFlags(TClientType::ELeaving); - } - - if (aSender == iTopMcprId) - { - iTopMcprId.SetNull(); + if (aSender == iTopMcprId) + { + iTopMcprId.SetNull(); + } } } SelectionError(aSender, error.iValue); @@ -260,9 +259,18 @@ __ASSERT_DEBUG(!iDestroying, User::Panic(KSpecAssert_ESockSSockscnslc, 17)); iDestroying = ETrue; - //We are not ready to destruct ourselves yet, waiting for TErrors if (iActiveRequests.Count()!=0) { + /* + Unfortunatelly today the parent of 'this' (CConnection or CFlowRequest) doesn't handle ownership + with 'this' very well and it may (in cancelation scenarios it will) bail out right after posting TDestroy + to 'this'. This is not good because the TSelect protocol carries data owned by the parent (selection preferences) + and MCPRs may attempt to access them after the owner/parent has gone away. We're making it illegal for the + parent to post TDestroy before all requests are completed. Consequently before posting TDestroy the parent + must make sure the selection is complete by awaiting response to the TSelect protocol. If it wants to + terminate selection it _must_ send TCancel (and await responses) before posting TDestroy. + */ + __ASSERT_DEBUG(EFalse, User::Panic(KSpecAssert_ESockSSockscnslc, 44)); return; }