shdocvw: Move more initialization code to DocHost_Init.
diff --git a/dlls/shdocvw/dochost.c b/dlls/shdocvw/dochost.c
index dbebc77..7335f53 100644
--- a/dlls/shdocvw/dochost.c
+++ b/dlls/shdocvw/dochost.c
@@ -478,16 +478,19 @@
DocHostUIHandler_GetOverrideKeyPath
};
-void DocHost_Init(DocHost *This)
+void DocHost_Init(DocHost *This, IDispatch *disp)
{
This->lpDocHostUIHandlerVtbl = &DocHostUIHandler2Vtbl;
This->lpOleCommandTargetVtbl = &OleCommandTargetVtbl;
+ This->disp = disp;
+
This->document = NULL;
This->hostui = NULL;
This->hwnd = NULL;
This->frame_hwnd = NULL;
+ This->url = NULL;
DocHost_ClientSite_Init(This);
DocHost_Frame_Init(This);
@@ -498,4 +501,6 @@
{
DocHost_ClientSite_Release(This);
DocHost_Events_Release(This);
+
+ SysFreeString(This->url);
}
diff --git a/dlls/shdocvw/shdocvw.h b/dlls/shdocvw/shdocvw.h
index 9228478..66730cf 100644
--- a/dlls/shdocvw/shdocvw.h
+++ b/dlls/shdocvw/shdocvw.h
@@ -153,7 +153,7 @@
void WebBrowser_OleObject_Destroy(WebBrowser*);
-void DocHost_Init(DocHost*);
+void DocHost_Init(DocHost*,IDispatch*);
void DocHost_ClientSite_Init(DocHost*);
void DocHost_Events_Init(DocHost*);
void DocHost_Frame_Init(DocHost*);
diff --git a/dlls/shdocvw/webbrowser.c b/dlls/shdocvw/webbrowser.c
index cb2d284..0dd1e32 100644
--- a/dlls/shdocvw/webbrowser.c
+++ b/dlls/shdocvw/webbrowser.c
@@ -132,7 +132,6 @@
WebBrowser_OleObject_Destroy(This);
- SysFreeString(This->doc_host.url);
HeapFree(GetProcessHeap(), 0, This);
SHDOCVW_UnlockModule();
}
@@ -844,10 +843,7 @@
ret->lpWebBrowser2Vtbl = &WebBrowser2Vtbl;
ret->ref = 0;
- ret->doc_host.url = NULL;
-
- ret->doc_host.disp = (IDispatch*)WEBBROWSER2(ret);
- DocHost_Init(&ret->doc_host);
+ DocHost_Init(&ret->doc_host, (IDispatch*)WEBBROWSER2(ret));
WebBrowser_OleObject_Init(ret);
WebBrowser_ViewObject_Init(ret);