Jacek Caban : mshtml: Don't share nsoption reference with nsnode.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Sep 25 14:15:16 CDT 2014


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Sep 25 12:11:19 2014 +0200

mshtml: Don't share nsoption reference with nsnode.

---

 dlls/mshtml/htmloption.c | 38 +++++++++++++++++++++++++++++++++-----
 1 file changed, 33 insertions(+), 5 deletions(-)

diff --git a/dlls/mshtml/htmloption.c b/dlls/mshtml/htmloption.c
index 4738eb5..b5c8b7d 100644
--- a/dlls/mshtml/htmloption.c
+++ b/dlls/mshtml/htmloption.c
@@ -311,13 +311,44 @@ static HRESULT HTMLOptionElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
     return HTMLElement_QI(&This->element.node, riid, ppv);
 }
 
+static void HTMLOptionElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
+{
+    HTMLOptionElement *This = impl_from_HTMLDOMNode(iface);
+
+    if(This->nsoption)
+        note_cc_edge((nsISupports*)This->nsoption, "This->nsoption", cb);
+}
+
+static void HTMLOptionElement_unlink(HTMLDOMNode *iface)
+{
+    HTMLOptionElement *This = impl_from_HTMLDOMNode(iface);
+
+    if(This->nsoption) {
+        nsIDOMHTMLOptionElement *nsoption = This->nsoption;
+
+        This->nsoption = NULL;
+        nsIDOMHTMLOptionElement_Release(nsoption);
+    }
+}
+
 static const NodeImplVtbl HTMLOptionElementImplVtbl = {
     HTMLOptionElement_QI,
     HTMLElement_destructor,
     HTMLElement_cpc,
     HTMLElement_clone,
     HTMLElement_handle_event,
-    HTMLElement_get_attr_col
+    HTMLElement_get_attr_col,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    HTMLOptionElement_traverse,
+    HTMLOptionElement_unlink
 };
 
 static const tid_t HTMLOptionElement_iface_tids[] = {
@@ -347,10 +378,7 @@ HRESULT HTMLOptionElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nsele
     HTMLElement_Init(&ret->element, doc, nselem, &HTMLOptionElement_dispex);
 
     nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLOptionElement, (void**)&ret->nsoption);
-
-    /* Share nsoption reference with nsnode */
-    assert(nsres == NS_OK && (nsIDOMNode*)ret->nsoption == ret->element.node.nsnode);
-    nsIDOMNode_Release(ret->element.node.nsnode);
+    assert(nsres == NS_OK);
 
     *elem = &ret->element;
     return S_OK;




More information about the wine-cvs mailing list