From: Daniel Lehman Subject: [PATCH v3 1/4] msxml3: Allow creating floating attributes. Message-Id: <20181016041436.4842-1-dlehman25@gmail.com> Date: Mon, 15 Oct 2018 21:14:33 -0700 Signed-off-by: Daniel Lehman --- 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 637615b341..8eb2695128 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 6e00aa0116..4faeed400c 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 94ef66b23d..abc6ab3465 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 bcb4181374..fc18935b69 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 ); -- 2.17.1