Module: wine Branch: master Commit: 2c1fe7f0c8b2bb05741aad36240b8ce888b4ae61 URL: http://source.winehq.org/git/wine.git/?a=commit;h=2c1fe7f0c8b2bb05741aad3624...
Author: Jacek Caban jacek@codeweavers.com Date: Wed Jul 11 13:51:39 2012 +0200
mshtml: Moved detaching inner window to separated function.
---
dlls/mshtml/htmlwindow.c | 50 ++++++++++++++++++++++----------------------- 1 files changed, 24 insertions(+), 26 deletions(-)
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 340ca44..d448614 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -43,8 +43,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
static struct list window_list = LIST_INIT(window_list);
-static HRESULT window_set_docnode(HTMLOuterWindow*,HTMLDocumentNode*); - static inline BOOL is_outer_window(HTMLWindow *window) { return &window->outer_window->base == window; @@ -107,6 +105,25 @@ static inline HRESULT get_window_event(HTMLWindow *window, eventid_t eid, VARIAN return get_event_handler(&window->inner_window->doc->body_event_target, eid, var); }
+static void detach_inner_window(HTMLOuterWindow *outer_window) +{ + HTMLInnerWindow *window = outer_window->base.inner_window; + + if(!window) + return; + + if(outer_window->doc_obj && outer_window == outer_window->doc_obj->basedoc.window) + window->doc->basedoc.cp_container.forward_container = NULL; + + detach_events(window->doc); + abort_window_bindings(window); + release_script_hosts(window); + window->doc->basedoc.window = NULL; + window->base.outer_window = NULL; + + IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); +} + static inline HTMLWindow *impl_from_IHTMLWindow2(IHTMLWindow2 *iface) { return CONTAINING_RECORD(iface, HTMLWindow, IHTMLWindow2_iface); @@ -183,7 +200,7 @@ static void release_outer_window(HTMLOuterWindow *This) remove_target_tasks(This->task_magic); set_window_bscallback(This, NULL); set_current_mon(This, NULL); - window_set_docnode(This, NULL); + detach_inner_window(This); release_children(This);
if(This->secmgr) @@ -2667,32 +2684,13 @@ static HRESULT window_set_docnode(HTMLOuterWindow *window, HTMLDocumentNode *doc HTMLInnerWindow *inner_window; HRESULT hres;
- if(window->base.inner_window) { - if(window->doc_obj && window == window->doc_obj->basedoc.window) - window->base.inner_window->doc->basedoc.cp_container.forward_container = NULL; - detach_events(window->base.inner_window->doc); - abort_window_bindings(window->base.inner_window); - release_script_hosts(window->base.inner_window); - } - - if(doc_node) { - hres = create_inner_window(window, doc_node, &inner_window); - if(FAILED(hres)) - return hres; - }else { - inner_window = NULL; - } + hres = create_inner_window(window, doc_node, &inner_window); + if(FAILED(hres)) + return hres;
- if(window->base.inner_window) { - window->base.inner_window->doc->basedoc.window = NULL; - window->base.inner_window->base.outer_window = NULL; - IHTMLWindow2_Release(&window->base.inner_window->base.IHTMLWindow2_iface); - } + detach_inner_window(window); window->base.inner_window = inner_window;
- if(!doc_node) - return S_OK; - if(window->doc_obj && window->doc_obj->basedoc.window == window) { if(window->doc_obj->basedoc.doc_node) htmldoc_release(&window->doc_obj->basedoc.doc_node->basedoc);