Jacek Caban : mshtml: Properly handle duplicated names with different DISPIDs in add_func_info.

Alexandre Julliard julliard at winehq.org
Thu Jul 7 09:48:23 CDT 2016


Module: wine
Branch: master
Commit: c20c47b85ebb59f01e6ddb6a8da264ff465ebf8d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c20c47b85ebb59f01e6ddb6a8da264ff465ebf8d

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Jul  7 12:50:03 2016 +0200

mshtml: Properly handle duplicated names with different DISPIDs in add_func_info.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mshtml/dispex.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c
index d934f56..2013cee 100644
--- a/dlls/mshtml/dispex.c
+++ b/dlls/mshtml/dispex.c
@@ -231,12 +231,19 @@ static BOOL is_arg_type_supported(VARTYPE vt)
 static void add_func_info(dispex_data_t *data, tid_t tid, const FUNCDESC *desc, ITypeInfo *dti)
 {
     func_info_t *info;
+    BSTR name;
     HRESULT hres;
 
+    hres = ITypeInfo_GetDocumentation(dti, desc->memid, &name, NULL, NULL, NULL);
+    if(FAILED(hres))
+        return;
+
     for(info = data->funcs; info < data->funcs+data->func_cnt; info++) {
-        if(info->id == desc->memid) {
-            if(info->tid != tid)
+        if(info->id == desc->memid || !strcmpW(info->name, name)) {
+            if(info->tid != tid) {
+                SysFreeString(name);
                 return; /* Duplicated in other interface */
+            }
             break;
         }
     }
@@ -246,16 +253,15 @@ static void add_func_info(dispex_data_t *data, tid_t tid, const FUNCDESC *desc,
             data->funcs = heap_realloc_zero(data->funcs, (data->func_size <<= 1)*sizeof(func_info_t));
         info = data->funcs+data->func_cnt;
 
-        hres = ITypeInfo_GetDocumentation(dti, desc->memid, &info->name, NULL, NULL, NULL);
-        if(FAILED(hres))
-            return;
-
         data->func_cnt++;
 
         info->id = desc->memid;
+        info->name = name;
         info->tid = tid;
         info->func_disp_idx = -1;
         info->prop_vt = VT_EMPTY;
+    }else {
+        SysFreeString(name);
     }
 
     if(desc->invkind & DISPATCH_METHOD) {




More information about the wine-cvs mailing list