Commit 068f2440 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Remove the inner window ref from the doc only when it is actually unlinked.

parent 1593f2f5
...@@ -5707,12 +5707,6 @@ void detach_document_node(HTMLDocumentNode *doc) ...@@ -5707,12 +5707,6 @@ void detach_document_node(HTMLDocumentNode *doc)
{ {
unsigned i; unsigned i;
if(doc->window) {
HTMLInnerWindow *window = doc->window;
doc->window = NULL;
IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface);
}
while(!list_empty(&doc->plugin_hosts)) while(!list_empty(&doc->plugin_hosts))
detach_plugin_host(LIST_ENTRY(list_head(&doc->plugin_hosts), PluginHost, entry)); detach_plugin_host(LIST_ENTRY(list_head(&doc->plugin_hosts), PluginHost, entry));
...@@ -5884,14 +5878,20 @@ static void HTMLDocumentNode_traverse(DispatchEx *dispex, nsCycleCollectionTrave ...@@ -5884,14 +5878,20 @@ static void HTMLDocumentNode_traverse(DispatchEx *dispex, nsCycleCollectionTrave
static void HTMLDocumentNode_unlink(DispatchEx *dispex) static void HTMLDocumentNode_unlink(DispatchEx *dispex)
{ {
HTMLDocumentNode *This = impl_from_DispatchEx(dispex); HTMLDocumentNode *This = impl_from_DispatchEx(dispex);
HTMLInnerWindow *window = This->window;
HTMLDOMNode_unlink(dispex); HTMLDOMNode_unlink(dispex);
if(window) {
This->window = NULL;
IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface);
}
if(This->dom_document) { if(This->dom_document) {
release_document_mutation(This); release_document_mutation(This);
detach_document_node(This); detach_document_node(This);
This->dom_document = NULL; This->dom_document = NULL;
This->html_document = NULL; This->html_document = NULL;
}else if(This->window) { }else if(window) {
detach_document_node(This); detach_document_node(This);
} }
} }
......
...@@ -3589,7 +3589,14 @@ static void test_doc_obj(IHTMLDocument2 *doc) ...@@ -3589,7 +3589,14 @@ static void test_doc_obj(IHTMLDocument2 *doc)
ok(hres == S_OK, "get_document failed: %08lx\n", hres); ok(hres == S_OK, "get_document failed: %08lx\n", hres);
ok(doc_node != doc_node2, "doc_node == doc_node2\n"); ok(doc_node != doc_node2, "doc_node == doc_node2\n");
IHTMLDocument2_Release(doc_node2); IHTMLDocument2_Release(doc_node2);
hres = IHTMLDocument2_get_parentWindow(doc_node, &window2);
todo_wine
ok(hres == S_OK, "get_parentWindow failed: %08lx\n", hres);
todo_wine
ok(window == window2, "window != window2\n");
IHTMLDocument2_Release(doc_node); IHTMLDocument2_Release(doc_node);
if(hres == S_OK) IHTMLWindow2_Release(window2);
hres = IHTMLWindow2_get_location(window, &location2); hres = IHTMLWindow2_get_location(window, &location2);
ok(hres == S_OK, "get_location failed: %08lx\n", hres); ok(hres == S_OK, "get_location failed: %08lx\n", hres);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment