diff -r c1f20ce4abcf -r 3e88ff8f41d5 kerneltest/e32test/resourceman/d_rescontrolcli.cpp --- a/kerneltest/e32test/resourceman/d_rescontrolcli.cpp Tue Aug 31 16:34:26 2010 +0300 +++ b/kerneltest/e32test/resourceman/d_rescontrolcli.cpp Wed Sep 01 12:34:56 2010 +0100 @@ -283,6 +283,12 @@ { if(iDfcQ) iDfcQ->Destroy(); + if(iStaticRes) + delete iStaticRes; + if(iStaticResArray[0]) + delete iStaticResArray[0]; + if(iStaticResArray[2]) + delete iStaticResArray[2]; } /** Entry point for this driver */ @@ -313,7 +319,7 @@ return NULL; } //Allocating memory earlier so that during failure conditions can cleanup easily - p->iStaticRes = new DLaterRegisterStaticResource(); // it will be registered, and later destroyed by the ResourceManager + p->iStaticRes = new DLaterRegisterStaticResource(); if(!p->iStaticRes) { delete p->iClient.pName; @@ -321,7 +327,7 @@ p->AsyncDelete(); return NULL; } - p->iStaticResArray[0] = new DLaterRegisterStaticResource1(); // it will be registered, and later destroyed by the ResourceManager + p->iStaticResArray[0] = new DLaterRegisterStaticResource1(); if(!p->iStaticResArray[0]) { delete p->iStaticRes; @@ -406,6 +412,13 @@ { if (iOpenChannels != 0) //A Channel is already open return KErrInUse; + //Deregister the client registered in ldd init. + TInt r = PowerResourceManager::DeRegisterClient(DTestResManLddFactory::iClient.iClientId); + if(r != KErrNone) + Kern::Fault("PRM CLIENT DEREGISTER FAILED", __LINE__); + delete DTestResManLddFactory::iClient.pName; + DTestResManLddFactory::iClient.pName = NULL; + DTestResManLddFactory::iClient.iClientId = 0; aChannel = new DTestResManLdd; if(!aChannel) return KErrNoMemory; @@ -501,17 +514,7 @@ } } -/** - Function used for polling the PostBoot Notification status. -*/ -TBool PollingPostBootStatus(TAny* aLddFactory) - { - if(aLddFactory) - if(((DTestResManLddFactory *)aLddFactory)->iPostBootNotiCount == EXPECTED_POST_NOTI_COUNT) - return ETrue; - return EFalse; - } - + /** Process synchronous 'control' requests */ @@ -987,9 +990,12 @@ } case RTestResMan::ECheckPostBootLevelNotifications: { - //aPollPeriodMs = 3ms (3rd argument) - //aMaxPoll = 1000 (in total ~3000 ms timeout) - r = Kern::PollingWait(PollingPostBootStatus, (TAny*)iDevice, 3, 1000); + if(DTestResManLddFactory::iPostBootNotiCount != EXPECTED_POST_NOTI_COUNT) + { + r = KErrUnderflow; + break; + } + r = KErrNone; break; } case RTestResMan::EGetControllerVersion: @@ -1329,17 +1335,6 @@ iPostBootNotiCount++; DPowerResourceNotification *ptr = (DPowerResourceNotification*)aParam; TInt r = PowerResourceManager::CancelNotification(iClient.iClientId, aResId, *ptr); - if(r == KErrCancel) - { - ptr->AsyncDelete(); - if(iPostBootNotiCount == EXPECTED_POST_NOTI_COUNT) - { - r = PowerResourceManager::DeRegisterClient(DTestResManLddFactory::iClient.iClientId); - if(r != KErrNone) - Kern::Fault("PRM CLIENT DEREGISTER FAILED", __LINE__); - delete DTestResManLddFactory::iClient.pName; - DTestResManLddFactory::iClient.pName = NULL; - DTestResManLddFactory::iClient.iClientId = 0; - } - } + if(r == KErrNone) + delete ptr; }