uiacceltk/hitchcock/coretoolkit/src/HuiFxEffectCache.cpp
branchRCL_3
changeset 3 d8a3531bc6b8
parent 0 15bf7259bb7c
child 8 10534483575f
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffectCache.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffectCache.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -63,11 +63,17 @@
 void CHuiFxEffectCache::CreateL(MHuiFxEffectCacheNode *aNode)
     { // registration of fxml file
     MHuiFxEffectCacheNode *cachedNode = Find(aNode);
+    MHuiFxEffectCacheNode *dupNode = FindDuplicate(aNode);
     if (cachedNode)
        { // found in cache => duplicate registration => no need to do anything
        cachedNode->Ref(1);
        delete aNode;
        }
+    else if (dupNode)
+        { // found same file already being loaded
+        dupNode->Ref(1);
+        delete aNode;
+        }
     else
        { // not found in cache, so insert it and start parsing the effect.
        TInt id = UniqueId();
@@ -119,14 +125,14 @@
        TInt count = cachedNode->Ref(-1);
        if (count == 0)
            {
+           Remove(iCachedEffects, cachedNode);
            delete cachedNode;
-           Remove(iCachedEffects, cachedNode);
            }
        }
    if (cachedNode != aNode)
        { // this node was not found in iCachedEffects array, so it needs to be in iDuplicateEffects array
+       Remove(iDuplicateEffects, aNode);
        delete aNode;
-       Remove(iDuplicateEffects, aNode);
        }
    }
 
@@ -161,6 +167,19 @@
 	}
    return 0;
    }
+MHuiFxEffectCacheNode *CHuiFxEffectCache::FindDuplicate(MHuiFxEffectCacheNode *aNode)
+    {
+    TInt size = iDuplicateEffects.Count();
+    for(TInt i=0;i<size;i++)
+        {
+        MHuiFxEffectCacheNode *node = iDuplicateEffects[i].iNode;
+        if (Compare(node, aNode))
+            {
+            return node;
+            }
+        }
+    return 0;
+    }
 
 TInt CHuiFxEffectCache::FindById(TInt aId)
     {