From: Jacek Caban Subject: [PATCH 2/3] mshtml: Store task_magic in HTMLDocumentObj instead of HTMLDocument. Message-Id: <4c92cd81-c606-5594-1b4d-79870898c825@codeweavers.com> Date: Thu, 23 Nov 2017 17:36:51 +0100 Signed-off-by: Jacek Caban --- dlls/mshtml/editor.c | 2 +- dlls/mshtml/htmldoc.c | 14 ++++---------- dlls/mshtml/mshtml_private.h | 3 +-- dlls/mshtml/persist.c | 4 ++-- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/dlls/mshtml/editor.c b/dlls/mshtml/editor.c index b64b35a926..8323a772ad 100644 --- a/dlls/mshtml/editor.c +++ b/dlls/mshtml/editor.c @@ -1291,7 +1291,7 @@ HRESULT setup_edit_mode(HTMLDocumentObj *doc) if(doc->basedoc.window->mon) { /* FIXME: We should find nicer way to do this */ - remove_target_tasks(doc->basedoc.task_magic); + remove_target_tasks(doc->task_magic); mon = doc->basedoc.window->mon; IMoniker_AddRef(mon); diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 5899b84aed..c9f21fa00c 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -4858,7 +4858,6 @@ static void init_doc(HTMLDocument *doc, IUnknown *outer, IDispatchEx *dispex) doc->outer_unk = outer; doc->dispex = dispex; - doc->task_magic = get_task_target_magic(); HTMLDocument_Persist_Init(doc); HTMLDocument_OleCmd_Init(doc); @@ -4869,13 +4868,6 @@ static void init_doc(HTMLDocument *doc, IUnknown *outer, IDispatchEx *dispex) ConnectionPointContainer_Init(&doc->cp_container, (IUnknown*)&doc->IHTMLDocument2_iface, HTMLDocument_cpc); } -static void destroy_htmldoc(HTMLDocument *This) -{ - remove_target_tasks(This->task_magic); - - ConnectionPointContainer_Destroy(&This->cp_container); -} - static inline HTMLDocumentNode *impl_from_HTMLDOMNode(HTMLDOMNode *iface) { return CONTAINING_RECORD(iface, HTMLDocumentNode, node); @@ -4925,7 +4917,7 @@ static void HTMLDocumentNode_destructor(HTMLDOMNode *iface) } heap_free(This->event_vector); - destroy_htmldoc(&This->basedoc); + ConnectionPointContainer_Destroy(&This->basedoc.cp_container); } static HRESULT HTMLDocumentNode_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret) @@ -5298,7 +5290,8 @@ static ULONG WINAPI HTMLDocumentObj_Release(IUnknown *iface) DestroyWindow(This->hwnd); heap_free(This->mime); - destroy_htmldoc(&This->basedoc); + remove_target_tasks(This->task_magic); + ConnectionPointContainer_Destroy(&This->basedoc.cp_container); release_dispex(&This->dispex); if(This->nscontainer) @@ -5429,6 +5422,7 @@ static HRESULT create_document_object(BOOL is_mhtml, IUnknown *outer, REFIID rii doc->is_mhtml = is_mhtml; doc->usermode = UNKNOWN_USERMODE; + doc->task_magic = get_task_target_magic(); init_binding_ui(doc); diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index ea81fdecfe..69fe90c810 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -602,8 +602,6 @@ struct HTMLDocument { HTMLOuterWindow *window; - LONG task_magic; - ConnectionPointContainer cp_container; }; @@ -672,6 +670,7 @@ struct HTMLDocumentObj { LPWSTR mime; DWORD update; + LONG task_magic; }; typedef struct nsWeakReference nsWeakReference; diff --git a/dlls/mshtml/persist.c b/dlls/mshtml/persist.c index a34ff51522..25767ef57c 100644 --- a/dlls/mshtml/persist.c +++ b/dlls/mshtml/persist.c @@ -424,7 +424,7 @@ HRESULT set_moniker(HTMLOuterWindow *window, IMoniker *mon, IUri *nav_uri, IBind task = heap_alloc(sizeof(docobj_task_t)); task->doc = doc_obj; - hres = push_task(&task->header, set_progress_proc, NULL, doc_obj->basedoc.task_magic); + hres = push_task(&task->header, set_progress_proc, NULL, doc_obj->task_magic); if(FAILED(hres)) { CoTaskMemFree(url); return hres; @@ -435,7 +435,7 @@ HRESULT set_moniker(HTMLOuterWindow *window, IMoniker *mon, IUri *nav_uri, IBind download_task->doc = doc_obj; download_task->set_download = set_download; download_task->url = url; - return push_task(&download_task->header, set_downloading_proc, set_downloading_task_destr, doc_obj->basedoc.task_magic); + return push_task(&download_task->header, set_downloading_proc, set_downloading_task_destr, doc_obj->task_magic); } return S_OK;