diff -r f5b12b673c07 -r d2396c80c344 commsfwsupport/commselements/meshmachine/src/mm_node.cpp --- a/commsfwsupport/commselements/meshmachine/src/mm_node.cpp Mon May 24 18:38:45 2010 +0100 +++ b/commsfwsupport/commselements/meshmachine/src/mm_node.cpp Mon May 24 18:44:15 2010 +0100 @@ -231,7 +231,7 @@ for (TInt i = iActivities.Count() - 1; i>=0 && a==NULL; i--) { CNodeActivityBase* act = iActivities[i]; - const TNodeId& postedTo = act->iPostedToId; + const TNodeId& postedTo = act->PostedToNodeId(); if (!act->IsIdle() && (postedTo.IsNull() || aContext.iSender == postedTo) && (recipient->NodeCtx() == act->ActivityId())) @@ -429,6 +429,7 @@ } } + EXPORT_C void AMMNodeBase::AbortActivitiesOriginatedBy(TNodeContextBase& aContext, const TNodeId& aCommsId, TBool aIsNodeBeingDestroyed) { CNodeActivityBase* caller = aContext.iNodeActivity; @@ -437,6 +438,20 @@ for (TInt i = iActivities.Count() - 1; i>=0; i--) { aContext.iNodeActivity = iActivities[i]; + + if (!abortAll && aContext.iNodeActivity->PostedToNodeId() == aCommsId) + {//clear postedto if a leaver has been set as a postedto at any of the running activities. + //No other messages will ever come from the leaver and it is not gonna be safe to forward TCancels + //to the leaver, so at least postedto must be cleared to avoid the crash. It could be speculated that + //if the postedto is still set, then either the postedto node failed to respond or the local activity failed to + //clear postedto when it had responded. Worth putting a speculative ASSERT here to catch misdeeds. + + //clearing postedto shouldn't be done in here (AbortActivitiesOriginatedBy), but I (RZ) have expressed my disrespect to the + //this method before and the suggestion that it should go (replaced by a CancelActivitiesOriginatedBy). + //So instead of introducing another method that loops through activities i decided to piggyback the function in an + //existing method. Note that the final logic should be based on RNodeInterfaces and not TNodeIds. + aContext.iNodeActivity->ClearPostedTo(); + } // We dont want to abort already idle activities or they may error. if(aContext.iNodeActivity->IsIdle())