typelib: fix tlb cache

Huw D M Davies h.davies1 at physics.ox.ac.uk
Tue Feb 22 08:29:01 CST 2005


        Huw Davies <huw at codeweavers.com>
        The typelib cache should take the typelib resource index
        into account.
-- 
Huw Davies
huw at codeweavers.com
Index: dlls/oleaut32/typelib.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/typelib.c,v
retrieving revision 1.141
diff -u -p -r1.141 typelib.c
--- dlls/oleaut32/typelib.c	21 Feb 2005 18:34:41 -0000	1.141
+++ dlls/oleaut32/typelib.c	22 Feb 2005 14:26:51 -0000
@@ -848,9 +848,10 @@ typedef struct tagITypeLibImpl
 				   libary. Only used while read MSFT
 				   typelibs */
 
-    /* typelibs are cached, keyed by path, so store the linked list info within them */
+    /* typelibs are cached, keyed by path and index, so store the linked list info within them */
     struct tagITypeLibImpl *next, *prev;
     WCHAR *path;
+    INT index;
 } ITypeLibImpl;
 
 static struct ITypeLib2Vtbl tlbvt;
@@ -2169,7 +2170,7 @@ int TLB_ReadTypeLib(LPCWSTR pszFileName,
     EnterCriticalSection(&cache_section);
     for (entry = tlb_cache_first; entry != NULL; entry = entry->next)
     {
-        if (!strcmpiW(entry->path, pszFileName))
+        if (!strcmpiW(entry->path, pszFileName) && entry->index == index)
         {
             TRACE("cache hit\n");
             *ppTypeLib = (ITypeLib2*)entry;
@@ -2263,6 +2264,7 @@ int TLB_ReadTypeLib(LPCWSTR pszFileName,
 	impl->path = HeapAlloc(GetProcessHeap(), 0, (strlenW(pszFileName)+1) * sizeof(WCHAR));
 	lstrcpyW(impl->path, pszFileName);
 	/* We should really canonicalise the path here. */
+        impl->index = index;
 
         /* FIXME: check if it has added already in the meantime */
         EnterCriticalSection(&cache_section);



More information about the wine-patches mailing list