1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
107 { |
107 { |
108 folderNode->iDlink.Deque(); |
108 folderNode->iDlink.Deque(); |
109 delete folderNode; |
109 delete folderNode; |
110 } |
110 } |
111 |
111 |
112 iFreePoolInstance->ReleaseEntry(iRootEntry); |
112 iFreePoolInstance->ReleaseEntryL(iRootEntry); |
113 iRootEntry = NULL; |
113 iRootEntry = NULL; |
114 |
114 |
115 // 3. Delete internal data structure. |
115 // 3. Delete internal data structure. |
116 iNonCommittedAddedEntryList.ResetAndDestroy(); |
116 iNonCommittedAddedEntryList.ResetAndDestroy(); |
117 iNonCommittedChangedEntryList.Reset(); |
117 iNonCommittedChangedEntryList.Reset(); |
974 CMsvCacheEntry* entry = NULL; |
974 CMsvCacheEntry* entry = NULL; |
975 TBool releaseEntry = FindEntryL(aSelection.At(0), entry, EFalse); |
975 TBool releaseEntry = FindEntryL(aSelection.At(0), entry, EFalse); |
976 TMsvId parentId = entry->Entry().Parent(); |
976 TMsvId parentId = entry->Entry().Parent(); |
977 if(releaseEntry) |
977 if(releaseEntry) |
978 { |
978 { |
979 iFreePoolInstance->ReleaseEntry(entry, ETrue); |
979 iFreePoolInstance->ReleaseEntryL(entry, ETrue); |
980 } |
980 } |
981 CMsvEntrySelection* children = new(ELeave)CMsvEntrySelection; |
981 CMsvEntrySelection* children = new(ELeave)CMsvEntrySelection; |
982 CleanupStack::PushL(children); |
982 CleanupStack::PushL(children); |
983 |
983 |
984 for (TInt index=0; index<count; ++index) |
984 for (TInt index=0; index<count; ++index) |
1670 // If entry is not present in cache, |
1670 // If entry is not present in cache, |
1671 // it should be handled carefully. |
1671 // it should be handled carefully. |
1672 if(aIsDanglingEntry) |
1672 if(aIsDanglingEntry) |
1673 { |
1673 { |
1674 // Release CMsvCacheEntry to freepool. |
1674 // Release CMsvCacheEntry to freepool. |
1675 iFreePoolInstance->ReleaseEntry(serverEntry, ETrue); |
1675 iFreePoolInstance->ReleaseEntryL(serverEntry, ETrue); |
1676 } |
1676 } |
1677 return KErrNone; |
1677 return KErrNone; |
1678 } |
1678 } |
1679 else |
1679 else |
1680 { |
1680 { |
3668 TRAPD(err, iDbAdapter->DeleteEntryL(aId)); |
3668 TRAPD(err, iDbAdapter->DeleteEntryL(aId)); |
3669 // If the entry does not exists in cache, |
3669 // If the entry does not exists in cache, |
3670 // we need to release the entry explicitly. |
3670 // we need to release the entry explicitly. |
3671 if(releaseEntry) |
3671 if(releaseEntry) |
3672 { |
3672 { |
3673 iFreePoolInstance->ReleaseEntry(entry, ETrue); |
3673 iFreePoolInstance->ReleaseEntryL(entry, ETrue); |
3674 User::LeaveIfError(err); |
3674 User::LeaveIfError(err); |
3675 } |
3675 } |
3676 else |
3676 else |
3677 { |
3677 { |
3678 User::LeaveIfError(err); |
3678 User::LeaveIfError(err); |
3755 CMsvCacheEntry* entry = NULL; |
3755 CMsvCacheEntry* entry = NULL; |
3756 TBool releaseEntry = FindEntryL(aSelection.At(0), entry, EFalse); |
3756 TBool releaseEntry = FindEntryL(aSelection.At(0), entry, EFalse); |
3757 TMsvId parentId = entry->Entry().Parent(); |
3757 TMsvId parentId = entry->Entry().Parent(); |
3758 if(releaseEntry) |
3758 if(releaseEntry) |
3759 { |
3759 { |
3760 iFreePoolInstance->ReleaseEntry(entry, ETrue); |
3760 iFreePoolInstance->ReleaseEntryL(entry, ETrue); |
3761 } |
3761 } |
3762 |
3762 |
3763 // Find the parent in the cache - we may need to update its owner status flag both in cache and DB. |
3763 // Find the parent in the cache - we may need to update its owner status flag both in cache and DB. |
3764 TBool updateTheParent = ETrue; |
3764 TBool updateTheParent = ETrue; |
3765 TRAPD(err, releaseEntry = FindEntryL(parentId, entry, EFalse)); // can't let it leave - need to delete the child in any case. |
3765 TRAPD(err, releaseEntry = FindEntryL(parentId, entry, EFalse)); // can't let it leave - need to delete the child in any case. |
3766 if(err == KErrNotFound) |
3766 if(err == KErrNotFound) |
3767 { |
3767 { |
3768 updateTheParent = EFalse; |
3768 updateTheParent = EFalse; |
3769 if(releaseEntry) |
3769 if(releaseEntry) |
3770 { |
3770 { |
3771 iFreePoolInstance->ReleaseEntry(entry, ETrue); |
3771 iFreePoolInstance->ReleaseEntryL(entry, ETrue); |
3772 } |
3772 } |
3773 } |
3773 } |
3774 else |
3774 else |
3775 { |
3775 { |
3776 // Get parent's children. |
3776 // Get parent's children. |