Jacek Caban : mshtml: Don' t assume that HTMLWindow_Create sets ret val before succeeding.

Alexandre Julliard julliard at winehq.org
Wed Mar 9 11:12:47 CST 2011


Module: wine
Branch: master
Commit: 1913ff3a42d2f26460cd39ac749435abfe9e3d62
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1913ff3a42d2f26460cd39ac749435abfe9e3d62

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Mar  8 18:45:45 2011 +0100

mshtml: Don't assume that HTMLWindow_Create sets ret val before succeeding.

---

 dlls/mshtml/htmldoc.c    |    2 +-
 dlls/mshtml/htmlwindow.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 0d42d4f..6842b23 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -2019,7 +2019,7 @@ HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_ob
     if(!doc)
         return E_OUTOFMEMORY;
 
-    if(window == doc_obj->basedoc.window)
+    if(!doc_obj->basedoc.window || window == doc_obj->basedoc.window)
         doc->basedoc.cp_container.forward_container = &doc_obj->basedoc.cp_container;
 
     nsIDOMHTMLDocument_AddRef(nsdoc);
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index a4fa1be..99d03b3 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -2247,7 +2247,6 @@ HRESULT HTMLWindow_Create(HTMLDocumentObj *doc_obj, nsIDOMWindow *nswindow, HTML
     list_init(&window->script_hosts);
 
     window->task_magic = get_task_target_magic();
-    *ret = window;
     update_window_doc(window);
 
     list_init(&window->children);
@@ -2260,6 +2259,7 @@ HRESULT HTMLWindow_Create(HTMLDocumentObj *doc_obj, nsIDOMWindow *nswindow, HTML
         list_add_tail(&parent->children, &window->sibling_entry);
     }
 
+    *ret = window;
     return S_OK;
 }
 




More information about the wine-cvs mailing list