Jacek Caban : mshtml: Share nsdoc reference with nsnode.

Alexandre Julliard julliard at winehq.org
Wed Jun 27 19:13:59 CDT 2012


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Jun 27 10:56:44 2012 +0200

mshtml: Share nsdoc reference with nsnode.

---

 dlls/mshtml/htmldoc.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 6016630..5e98cea 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -20,6 +20,7 @@
 
 #include <stdarg.h>
 #include <stdio.h>
+#include <assert.h>
 
 #define COBJMACROS
 
@@ -2084,10 +2085,8 @@ static void HTMLDocumentNode_destructor(HTMLDOMNode *iface)
     while(!list_empty(&This->plugin_hosts))
         detach_plugin_host(LIST_ENTRY(list_head(&This->plugin_hosts), PluginHost, entry));
 
-    if(This->nsdoc) {
+    if(This->nsdoc)
         release_document_mutation(This);
-        nsIDOMHTMLDocument_Release(This->nsdoc);
-    }
 
     heap_free(This->event_vector);
     destroy_htmldoc(&This->basedoc);
@@ -2236,12 +2235,15 @@ HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_ob
     if(!doc_obj->basedoc.window || window == doc_obj->basedoc.window)
         doc->basedoc.cp_container.forward_container = &doc_obj->basedoc.cp_container;
 
-    nsIDOMHTMLDocument_AddRef(nsdoc);
+    HTMLDOMNode_Init(doc, &doc->node, (nsIDOMNode*)nsdoc);
+
+    /* No AddRef, share the reference with nsnode */
+    assert((nsIDOMNode*)nsdoc == doc->node.nsnode);
     doc->nsdoc = nsdoc;
+
     init_document_mutation(doc);
     doc_init_events(doc);
 
-    HTMLDOMNode_Init(doc, &doc->node, (nsIDOMNode*)nsdoc);
     doc->node.vtbl = &HTMLDocumentNodeImplVtbl;
     doc->node.cp_container = &doc->basedoc.cp_container;
 




More information about the wine-cvs mailing list