[PATCH v3 2/4] jscript: Don't overwrite the host_global if already set.

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


Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
 dlls/jscript/jscript.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/jscript/jscript.c b/dlls/jscript/jscript.c
index 5e9b153..8311eef 100644
--- a/dlls/jscript/jscript.c
+++ b/dlls/jscript/jscript.c
@@ -827,10 +827,10 @@ static HRESULT WINAPI JScript_AddNamedItem(IActiveScript *iface,
             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