msxml: It's valid to release an empty document
Huw D M Davies
h.davies1 at physics.ox.ac.uk
Tue Jan 10 08:37:13 CST 2006
Huw Davies <huw at codeweavers.com>
It's valid to release an empty document.
--
Huw Davies
huw at codeweavers.com
diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c
index ae96fa1..704e92e 100644
--- a/dlls/msxml3/node.c
+++ b/dlls/msxml3/node.c
@@ -743,8 +743,8 @@ static ULONG WINAPI Internal_Release(
ref = InterlockedDecrement( &This->ref );
if ( ref == 0 )
{
- assert( This->node->doc );
- xmldoc_release( This->node->doc );
+ if( This->node )
+ xmldoc_release( This->node->doc );
HeapFree( GetProcessHeap(), 0, This );
}
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index bb378c7..49c303b 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -517,6 +517,13 @@ static void test_refs(void)
CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument, (LPVOID*)&doc );
if( r != S_OK )
return;
+ ref = IXMLDOMDocument_Release(doc);
+ ok( ref == 0, "ref %ld\n", ref);
+
+ r = CoCreateInstance( &CLSID_DOMDocument, NULL,
+ CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument, (LPVOID*)&doc );
+ if( r != S_OK )
+ return;
str = SysAllocString( szComplete4 );
r = IXMLDOMDocument_loadXML( doc, str, &b );
More information about the wine-patches
mailing list