diff -r 68ef71f0cd72 -r 592244873960 datacommsserver/esockserver/ssock/ss_mmcommsprov.cpp --- a/datacommsserver/esockserver/ssock/ss_mmcommsprov.cpp Tue Feb 02 00:53:00 2010 +0200 +++ b/datacommsserver/esockserver/ssock/ss_mmcommsprov.cpp Fri Apr 16 16:15:03 2010 +0300 @@ -19,7 +19,9 @@ #include "ss_mmcommsprov.h" #include - +#include +#include "ss_nodemessages_internal.h" +#include "ss_internal_activities.h" #ifdef _DEBUG // Panic category for "absolutely impossible!" vanilla ASSERT()-type panics from this module @@ -112,17 +114,19 @@ void CMMCommsProviderBase::DestroyOrphanedDataClients() { - //Destroy orphaned data clients - RNodeInterface* dc; - TClientIter iter = GetClientIter(TClientType(TCFClientType::EData)); - while ((dc = iter++) != NULL) + // Note: If PRDataClientStopActivity is running, it will call PRStates::TDestroyOrphanedDataClients + // once it has stopped the data clients, so we don't need to start PRDestroyOrphans activity here. + // What was happening before was that we were destroying the Default data client before one or more + // non-Default clients. This causes problems due to internal references between some non-Default + // and Default data client types. + if (CountClients( + TClientType(TCFClientType::EData), + TClientType(0, TCFClientType::EActive|TCFClientType::EActivating|TCFClientType::ELeaving|TCFClientType::EStarted|TCFClientType::EStarting)) + && CountActivities(ECFActivityDestroyOrphans) == 0 + && CountActivities(ECFActivityDestroy) == 0 + && CountActivities(ECFActivityStopDataClient) == 0) { - if (!(dc->Flags()&(TCFClientType::EActive|TCFClientType::EActivating|TCFClientType::ELeaving|TCFClientType::EStarted|TCFClientType::EStarting))) - { - //AbortActivitiesOriginatedBy(dc->RecipientId(),aContext); - dc->PostMessage(Id(), TEChild::TDestroy().CRef()); - dc->SetFlags(TClientType::ELeaving); - } + RNodeInterface::OpenPostMessageClose(Id(), Id(), TCFMessage::TDestroyOrphans().CRef()); } }