Daniel Lehman : msxml3: Allow creating floating attributes.

Alexandre Julliard julliard at winehq.org
Mon Oct 22 15:38:43 CDT 2018


Module: wine
Branch: master
Commit: 27980430a0c858b90d995cb68cc8d31647cdae57
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=27980430a0c858b90d995cb68cc8d31647cdae57

Author: Daniel Lehman <dlehman25 at gmail.com>
Date:   Mon Oct 15 21:14:33 2018 -0700

msxml3: Allow creating floating attributes.

Signed-off-by: Daniel Lehman <dlehman25 at gmail.com>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msxml3/attribute.c     | 9 ++++++++-
 dlls/msxml3/element.c       | 2 +-
 dlls/msxml3/msxml_private.h | 2 +-
 dlls/msxml3/node.c          | 2 +-
 4 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/dlls/msxml3/attribute.c b/dlls/msxml3/attribute.c
index 637615b..8eb2695 100644
--- a/dlls/msxml3/attribute.c
+++ b/dlls/msxml3/attribute.c
@@ -50,6 +50,7 @@ typedef struct _domattr
     xmlnode node;
     IXMLDOMAttribute IXMLDOMAttribute_iface;
     LONG ref;
+    BOOL floating;
 } domattr;
 
 static const tid_t domattr_se_tids[] = {
@@ -116,6 +117,11 @@ static ULONG WINAPI domattr_Release(
     if ( ref == 0 )
     {
         destroy_xmlnode(&This->node);
+        if ( This->floating )
+        {
+            xmlFreeNs( This->node.node->ns );
+            xmlFreeNode( This->node.node );
+        }
         heap_free( This );
     }
 
@@ -709,7 +715,7 @@ static dispex_static_data_t domattr_dispex = {
     domattr_iface_tids
 };
 
-IUnknown* create_attribute( xmlNodePtr attribute )
+IUnknown* create_attribute( xmlNodePtr attribute, BOOL floating )
 {
     domattr *This;
 
@@ -719,6 +725,7 @@ IUnknown* create_attribute( xmlNodePtr attribute )
 
     This->IXMLDOMAttribute_iface.lpVtbl = &domattr_vtbl;
     This->ref = 1;
+    This->floating = floating;
 
     init_xmlnode(&This->node, attribute, (IXMLDOMNode*)&This->IXMLDOMAttribute_iface, &domattr_dispex);
 
diff --git a/dlls/msxml3/element.c b/dlls/msxml3/element.c
index 6e00aa0..4faeed4 100644
--- a/dlls/msxml3/element.c
+++ b/dlls/msxml3/element.c
@@ -1398,7 +1398,7 @@ static HRESULT WINAPI domelem_getAttributeNode(
 
     if (attr)
     {
-        IUnknown *unk = create_attribute((xmlNodePtr)attr);
+        IUnknown *unk = create_attribute((xmlNodePtr)attr, FALSE);
         hr = IUnknown_QueryInterface(unk, &IID_IXMLDOMAttribute, (void**)attributeNode);
         IUnknown_Release(unk);
     }
diff --git a/dlls/msxml3/msxml_private.h b/dlls/msxml3/msxml_private.h
index 94ef66b..abc6ab34 100644
--- a/dlls/msxml3/msxml_private.h
+++ b/dlls/msxml3/msxml_private.h
@@ -252,7 +252,7 @@ extern IUnknown         *create_domdoc( xmlNodePtr ) DECLSPEC_HIDDEN;
 extern IUnknown         *create_xmldoc( void ) DECLSPEC_HIDDEN;
 extern IXMLDOMNode      *create_node( xmlNodePtr ) DECLSPEC_HIDDEN;
 extern IUnknown         *create_element( xmlNodePtr ) DECLSPEC_HIDDEN;
-extern IUnknown         *create_attribute( xmlNodePtr ) DECLSPEC_HIDDEN;
+extern IUnknown         *create_attribute( xmlNodePtr, BOOL ) DECLSPEC_HIDDEN;
 extern IUnknown         *create_text( xmlNodePtr ) DECLSPEC_HIDDEN;
 extern IUnknown         *create_pi( xmlNodePtr ) DECLSPEC_HIDDEN;
 extern IUnknown         *create_comment( xmlNodePtr ) DECLSPEC_HIDDEN;
diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c
index bcb4181..fc18935 100644
--- a/dlls/msxml3/node.c
+++ b/dlls/msxml3/node.c
@@ -2271,7 +2271,7 @@ IXMLDOMNode *create_node( xmlNodePtr node )
         pUnk = create_element( node );
         break;
     case XML_ATTRIBUTE_NODE:
-        pUnk = create_attribute( node );
+        pUnk = create_attribute( node, FALSE );
         break;
     case XML_TEXT_NODE:
         pUnk = create_text( node );




More information about the wine-cvs mailing list