[PATCH v2 1/2] vbscript: Don't overwrite the host_global if already set.

Gabriel Ivăncescu gabrielopcode at gmail.com
Wed Feb 26 06:38:01 CST 2020


Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---

This is needed to pass the tests in next patch.

 dlls/vbscript/vbscript.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/vbscript/vbscript.c b/dlls/vbscript/vbscript.c
index 27985bf..1df6a29 100644
--- a/dlls/vbscript/vbscript.c
+++ b/dlls/vbscript/vbscript.c
@@ -676,10 +676,10 @@ static HRESULT WINAPI VBScript_AddNamedItem(IActiveScript *iface, LPCOLESTR pstr
             return hres;
         }
 
-        if(This->ctx->host_global)
-            IDispatch_Release(This->ctx->host_global);
-        IDispatch_AddRef(disp);
-        This->ctx->host_global = disp;
+        if(!This->ctx->host_global) {
+            IDispatch_AddRef(disp);
+            This->ctx->host_global = disp;
+        }
     }
 
     item = heap_alloc(sizeof(*item));
-- 
2.21.0




More information about the wine-devel mailing list