From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmlanchor.c | 8 +---- dlls/mshtml/htmlarea.c | 8 +---- dlls/mshtml/htmlbody.c | 7 +--- dlls/mshtml/htmldoc.c | 18 +++------- dlls/mshtml/htmlform.c | 8 +---- dlls/mshtml/htmlframe.c | 16 ++------- dlls/mshtml/htmlimg.c | 8 +---- dlls/mshtml/htmlinput.c | 16 ++------- dlls/mshtml/htmllink.c | 8 +---- dlls/mshtml/htmlnode.c | 7 +--- dlls/mshtml/htmlobject.c | 8 +---- dlls/mshtml/htmlscript.c | 8 +---- dlls/mshtml/htmlselect.c | 16 ++------- dlls/mshtml/htmlstyleelem.c | 14 ++------ dlls/mshtml/htmltable.c | 24 ++----------- dlls/mshtml/htmltextarea.c | 8 +---- dlls/mshtml/mshtml_private.h | 10 ++++++ dlls/mshtml/navigate.c | 16 ++------- dlls/mshtml/nsembed.c | 11 ++---- dlls/mshtml/nsevents.c | 5 +-- dlls/mshtml/nsio.c | 65 ++++++------------------------------ dlls/mshtml/oleobj.c | 48 ++++++-------------------- dlls/mshtml/persist.c | 12 ++----- dlls/mshtml/pluginhost.c | 17 ++-------- dlls/mshtml/script.c | 11 ++---- dlls/mshtml/view.c | 5 +-- 26 files changed, 70 insertions(+), 312 deletions(-)
diff --git a/dlls/mshtml/htmlanchor.c b/dlls/mshtml/htmlanchor.c index 7620bc45d81..988daa5d255 100644 --- a/dlls/mshtml/htmlanchor.c +++ b/dlls/mshtml/htmlanchor.c @@ -864,13 +864,7 @@ static void HTMLAnchorElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTrav static void HTMLAnchorElement_unlink(HTMLDOMNode *iface) { HTMLAnchorElement *This = impl_from_HTMLDOMNode(iface); - - if(This->nsanchor) { - nsIDOMHTMLAnchorElement *nsanchor = This->nsanchor; - - This->nsanchor = NULL; - nsIDOMHTMLAnchorElement_Release(nsanchor); - } + unlink_ref(&This->nsanchor); }
static const NodeImplVtbl HTMLAnchorElementImplVtbl = { diff --git a/dlls/mshtml/htmlarea.c b/dlls/mshtml/htmlarea.c index b6dbd0b28d5..2e4c92f8d4c 100644 --- a/dlls/mshtml/htmlarea.c +++ b/dlls/mshtml/htmlarea.c @@ -472,13 +472,7 @@ static void HTMLAreaElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraver static void HTMLAreaElement_unlink(HTMLDOMNode *iface) { HTMLAreaElement *This = impl_from_HTMLDOMNode(iface); - - if(This->nsarea) { - nsIDOMHTMLAreaElement *nsarea = This->nsarea; - - This->nsarea = NULL; - nsIDOMHTMLAreaElement_Release(nsarea); - } + unlink_ref(&This->nsarea); }
static const NodeImplVtbl HTMLAreaElementImplVtbl = { diff --git a/dlls/mshtml/htmlbody.c b/dlls/mshtml/htmlbody.c index 5ee2555e421..867aec39fc2 100644 --- a/dlls/mshtml/htmlbody.c +++ b/dlls/mshtml/htmlbody.c @@ -929,12 +929,7 @@ static void HTMLBodyElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraver static void HTMLBodyElement_unlink(HTMLDOMNode *iface) { HTMLBodyElement *This = impl_from_HTMLDOMNode(iface); - - if(This->nsbody) { - nsIDOMHTMLBodyElement *nsbody = This->nsbody; - This->nsbody = NULL; - nsIDOMHTMLBodyElement_Release(nsbody); - } + unlink_ref(&This->nsbody); }
static EventTarget *HTMLBodyElement_get_event_prop_target(HTMLDOMNode *iface, int event_id) diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 049b5c3559e..6777debecd0 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -5810,17 +5810,11 @@ void detach_document_node(HTMLDocumentNode *doc) while(!list_empty(&doc->plugin_hosts)) detach_plugin_host(LIST_ENTRY(list_head(&doc->plugin_hosts), PluginHost, entry));
- if(doc->dom_implementation) { + if(doc->dom_implementation) detach_dom_implementation(doc->dom_implementation); - IHTMLDOMImplementation_Release(doc->dom_implementation); - doc->dom_implementation = NULL; - } - - if(doc->namespaces) { - IHTMLNamespaceCollection_Release(doc->namespaces); - doc->namespaces = NULL; - }
+ unlink_ref(&doc->dom_implementation); + unlink_ref(&doc->namespaces); detach_events(doc); detach_selection(doc); detach_ranges(doc); @@ -5831,11 +5825,7 @@ void detach_document_node(HTMLDocumentNode *doc) doc->elem_vars_cnt = doc->elem_vars_size = 0; doc->elem_vars = NULL;
- if(doc->catmgr) { - ICatInformation_Release(doc->catmgr); - doc->catmgr = NULL; - } - + unlink_ref(&doc->catmgr); if(doc->browser) { list_remove(&doc->browser_entry); doc->browser = NULL; diff --git a/dlls/mshtml/htmlform.c b/dlls/mshtml/htmlform.c index 385cc6f9834..78b06391a8f 100644 --- a/dlls/mshtml/htmlform.c +++ b/dlls/mshtml/htmlform.c @@ -969,13 +969,7 @@ static void HTMLFormElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraver static void HTMLFormElement_unlink(HTMLDOMNode *iface) { HTMLFormElement *This = impl_from_HTMLDOMNode(iface); - - if(This->nsform) { - nsIDOMHTMLFormElement *nsform = This->nsform; - - This->nsform = NULL; - nsIDOMHTMLFormElement_Release(nsform); - } + unlink_ref(&This->nsform); }
static const NodeImplVtbl HTMLFormElementImplVtbl = { diff --git a/dlls/mshtml/htmlframe.c b/dlls/mshtml/htmlframe.c index acc5dbad8ca..126edc56181 100644 --- a/dlls/mshtml/htmlframe.c +++ b/dlls/mshtml/htmlframe.c @@ -1003,13 +1003,7 @@ static void HTMLFrameElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTrave static void HTMLFrameElement_unlink(HTMLDOMNode *iface) { HTMLFrameElement *This = frame_from_HTMLDOMNode(iface); - - if(This->framebase.nsframe) { - nsIDOMHTMLFrameElement *nsframe = This->framebase.nsframe; - - This->framebase.nsframe = NULL; - nsIDOMHTMLFrameElement_Release(nsframe); - } + unlink_ref(&This->framebase.nsframe); }
static const NodeImplVtbl HTMLFrameElementImplVtbl = { @@ -1596,13 +1590,7 @@ static void HTMLIFrame_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCa static void HTMLIFrame_unlink(HTMLDOMNode *iface) { HTMLIFrame *This = iframe_from_HTMLDOMNode(iface); - - if(This->framebase.nsiframe) { - nsIDOMHTMLIFrameElement *nsiframe = This->framebase.nsiframe; - - This->framebase.nsiframe = NULL; - nsIDOMHTMLIFrameElement_Release(nsiframe); - } + unlink_ref(&This->framebase.nsiframe); }
static const NodeImplVtbl HTMLIFrameImplVtbl = { diff --git a/dlls/mshtml/htmlimg.c b/dlls/mshtml/htmlimg.c index 47fc2be8d5d..d624c0e9df6 100644 --- a/dlls/mshtml/htmlimg.c +++ b/dlls/mshtml/htmlimg.c @@ -693,13 +693,7 @@ static void HTMLImgElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTravers static void HTMLImgElement_unlink(HTMLDOMNode *iface) { HTMLImg *This = impl_from_HTMLDOMNode(iface); - - if(This->nsimg) { - nsIDOMHTMLImageElement *nsimg = This->nsimg; - - This->nsimg = NULL; - nsIDOMHTMLImageElement_Release(nsimg); - } + unlink_ref(&This->nsimg); }
static const NodeImplVtbl HTMLImgElementImplVtbl = { diff --git a/dlls/mshtml/htmlinput.c b/dlls/mshtml/htmlinput.c index 4d59cf4f158..415b1aa7c59 100644 --- a/dlls/mshtml/htmlinput.c +++ b/dlls/mshtml/htmlinput.c @@ -1417,13 +1417,7 @@ static void HTMLInputElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTrave static void HTMLInputElement_unlink(HTMLDOMNode *iface) { HTMLInputElement *This = impl_from_HTMLDOMNode(iface); - - if(This->nsinput) { - nsIDOMHTMLInputElement *nsinput = This->nsinput; - - This->nsinput = NULL; - nsIDOMHTMLInputElement_Release(nsinput); - } + unlink_ref(&This->nsinput); }
static const NodeImplVtbl HTMLInputElementImplVtbl = { @@ -1962,13 +1956,7 @@ static void HTMLButtonElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTrav static void HTMLButtonElement_unlink(HTMLDOMNode *iface) { HTMLButtonElement *This = button_from_HTMLDOMNode(iface); - - if(This->nsbutton) { - nsIDOMHTMLButtonElement *nsbutton = This->nsbutton; - - This->nsbutton = NULL; - nsIDOMHTMLButtonElement_Release(nsbutton); - } + unlink_ref(&This->nsbutton); }
static const NodeImplVtbl HTMLButtonElementImplVtbl = { diff --git a/dlls/mshtml/htmllink.c b/dlls/mshtml/htmllink.c index d5ae5932e0e..82dc9b6dbe1 100644 --- a/dlls/mshtml/htmllink.c +++ b/dlls/mshtml/htmllink.c @@ -412,13 +412,7 @@ static void HTMLLinkElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTraver static void HTMLLinkElement_unlink(HTMLDOMNode *iface) { HTMLLinkElement *This = impl_from_HTMLDOMNode(iface); - - if(This->nslink) { - nsIDOMHTMLLinkElement *nslink = This->nslink; - - This->nslink = NULL; - nsIDOMHTMLLinkElement_Release(nslink); - } + unlink_ref(&This->nslink); } static const NodeImplVtbl HTMLLinkElementImplVtbl = { &CLSID_HTMLLinkElement, diff --git a/dlls/mshtml/htmlnode.c b/dlls/mshtml/htmlnode.c index b29383ad9ff..b20c1decddb 100644 --- a/dlls/mshtml/htmlnode.c +++ b/dlls/mshtml/htmlnode.c @@ -1597,12 +1597,7 @@ static nsresult NSAPI HTMLDOMNode_unlink(void *p) This->vtbl->unlink(This);
dispex_unlink(&This->event_target.dispex); - - if(This->nsnode) { - nsIDOMNode *nsnode = This->nsnode; - This->nsnode = NULL; - nsIDOMNode_Release(nsnode); - } + unlink_ref(&This->nsnode);
if(This->doc && &This->doc->node != This) { HTMLDocumentNode *doc = This->doc; diff --git a/dlls/mshtml/htmlobject.c b/dlls/mshtml/htmlobject.c index 6e29ccd640c..f70da7bb8df 100644 --- a/dlls/mshtml/htmlobject.c +++ b/dlls/mshtml/htmlobject.c @@ -740,13 +740,7 @@ static void HTMLObjectElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTrav static void HTMLObjectElement_unlink(HTMLDOMNode *iface) { HTMLObjectElement *This = impl_from_HTMLDOMNode(iface); - - if(This->nsobject) { - nsIDOMHTMLObjectElement *nsobject = This->nsobject; - - This->nsobject = NULL; - nsIDOMHTMLObjectElement_Release(nsobject); - } + unlink_ref(&This->nsobject); }
static const NodeImplVtbl HTMLObjectElementImplVtbl = { diff --git a/dlls/mshtml/htmlscript.c b/dlls/mshtml/htmlscript.c index 42cf63c47bd..b440224309f 100644 --- a/dlls/mshtml/htmlscript.c +++ b/dlls/mshtml/htmlscript.c @@ -423,13 +423,7 @@ static void HTMLScriptElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTrav static void HTMLScriptElement_unlink(HTMLDOMNode *iface) { HTMLScriptElement *This = impl_from_HTMLDOMNode(iface); - - if(This->nsscript) { - nsIDOMHTMLScriptElement *nsscript = This->nsscript; - - This->nsscript = NULL; - nsIDOMHTMLScriptElement_Release(nsscript); - } + unlink_ref(&This->nsscript); }
static const NodeImplVtbl HTMLScriptElementImplVtbl = { diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c index dd1c784c28d..31410e9f0f0 100644 --- a/dlls/mshtml/htmlselect.c +++ b/dlls/mshtml/htmlselect.c @@ -382,13 +382,7 @@ static void HTMLOptionElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTrav static void HTMLOptionElement_unlink(HTMLDOMNode *iface) { HTMLOptionElement *This = HTMLOptionElement_from_HTMLDOMNode(iface); - - if(This->nsoption) { - nsIDOMHTMLOptionElement *nsoption = This->nsoption; - - This->nsoption = NULL; - nsIDOMHTMLOptionElement_Release(nsoption); - } + unlink_ref(&This->nsoption); }
static const NodeImplVtbl HTMLOptionElementImplVtbl = { @@ -1458,13 +1452,7 @@ static void HTMLSelectElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTrav static void HTMLSelectElement_unlink(HTMLDOMNode *iface) { HTMLSelectElement *This = impl_from_HTMLDOMNode(iface); - - if(This->nsselect) { - nsIDOMHTMLSelectElement *nsselect = This->nsselect; - - This->nsselect = NULL; - nsIDOMHTMLSelectElement_Release(nsselect); - } + unlink_ref(&This->nsselect); }
static const NodeImplVtbl HTMLSelectElementImplVtbl = { diff --git a/dlls/mshtml/htmlstyleelem.c b/dlls/mshtml/htmlstyleelem.c index 434afcd46e3..4409f982343 100644 --- a/dlls/mshtml/htmlstyleelem.c +++ b/dlls/mshtml/htmlstyleelem.c @@ -393,11 +393,7 @@ static void HTMLStyleElement_destructor(HTMLDOMNode *iface) { HTMLStyleElement *This = impl_from_HTMLDOMNode(iface);
- if(This->style_sheet) { - IHTMLStyleSheet_Release(This->style_sheet); - This->style_sheet = NULL; - } - + unlink_ref(&This->style_sheet); HTMLElement_destructor(iface); }
@@ -412,13 +408,7 @@ static void HTMLStyleElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTrave static void HTMLStyleElement_unlink(HTMLDOMNode *iface) { HTMLStyleElement *This = impl_from_HTMLDOMNode(iface); - - if(This->nsstyle) { - nsIDOMHTMLStyleElement *nsstyle = This->nsstyle; - - This->nsstyle = NULL; - nsIDOMHTMLStyleElement_Release(nsstyle); - } + unlink_ref(&This->nsstyle); }
static void HTMLStyleElement_init_dispex_info(dispex_data_t *info, compat_mode_t mode) diff --git a/dlls/mshtml/htmltable.c b/dlls/mshtml/htmltable.c index 3cadc75b90d..cde97e5144c 100644 --- a/dlls/mshtml/htmltable.c +++ b/dlls/mshtml/htmltable.c @@ -485,13 +485,7 @@ static void HTMLTableCell_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversa static void HTMLTableCell_unlink(HTMLDOMNode *iface) { HTMLTableCell *This = HTMLTableCell_from_HTMLDOMNode(iface); - - if(This->nscell) { - nsIDOMHTMLTableCellElement *nscell = This->nscell; - - This->nscell = NULL; - nsIDOMHTMLTableCellElement_Release(nscell); - } + unlink_ref(&This->nscell); }
static const NodeImplVtbl HTMLTableCellImplVtbl = { @@ -931,13 +925,7 @@ static void HTMLTableRow_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversal static void HTMLTableRow_unlink(HTMLDOMNode *iface) { HTMLTableRow *This = HTMLTableRow_from_HTMLDOMNode(iface); - - if(This->nsrow) { - nsIDOMHTMLTableRowElement *nsrow = This->nsrow; - - This->nsrow = NULL; - nsIDOMHTMLTableRowElement_Release(nsrow); - } + unlink_ref(&This->nsrow); }
static const NodeImplVtbl HTMLTableRowImplVtbl = { @@ -1957,13 +1945,7 @@ static void HTMLTable_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCal static void HTMLTable_unlink(HTMLDOMNode *iface) { HTMLTable *This = impl_from_HTMLDOMNode(iface); - - if(This->nstable) { - nsIDOMHTMLTableElement *nstable = This->nstable; - - This->nstable = NULL; - nsIDOMHTMLTableElement_Release(nstable); - } + unlink_ref(&This->nstable); }
static const cpc_entry_t HTMLTable_cpc[] = { diff --git a/dlls/mshtml/htmltextarea.c b/dlls/mshtml/htmltextarea.c index 98468685eab..6b40b630112 100644 --- a/dlls/mshtml/htmltextarea.c +++ b/dlls/mshtml/htmltextarea.c @@ -443,13 +443,7 @@ static void HTMLTextAreaElement_traverse(HTMLDOMNode *iface, nsCycleCollectionTr static void HTMLTextAreaElement_unlink(HTMLDOMNode *iface) { HTMLTextAreaElement *This = impl_from_HTMLDOMNode(iface); - - if(This->nstextarea) { - nsIDOMHTMLTextAreaElement *nstextarea = This->nstextarea; - - This->nstextarea = NULL; - nsIDOMHTMLTextAreaElement_Release(nstextarea); - } + unlink_ref(&This->nstextarea); }
static const NodeImplVtbl HTMLTextAreaElementImplVtbl = { diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 803e1e38b4d..c0274bd8aac 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -1483,6 +1483,16 @@ static inline BOOL is_power_of_2(unsigned x) return !(x & (x - 1)); }
+static inline void unlink_ref(void *p) +{ + IUnknown **ref = p; + if(*ref) { + IUnknown *unk = *ref; + *ref = NULL; + IUnknown_Release(unk); + } +} + #ifdef __i386__ extern void *call_thiscall_func; #endif diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c index 112b63ba4b1..3583fb91069 100644 --- a/dlls/mshtml/navigate.c +++ b/dlls/mshtml/navigate.c @@ -335,15 +335,8 @@ static HRESULT WINAPI BindStatusCallback_OnStopBinding(IBindStatusCallback *ifac
hres = This->vtbl->stop_binding(This, hresult);
- if(This->binding) { - IBinding_Release(This->binding); - This->binding = NULL; - } - - if(This->mon) { - IMoniker_Release(This->mon); - This->mon = NULL; - } + unlink_ref(&This->binding); + unlink_ref(&This->mon);
list_remove(&This->entry); list_init(&This->entry); @@ -2016,10 +2009,7 @@ void abort_window_bindings(HTMLInnerWindow *window) window->bscallback = NULL; }
- if(window->mon) { - IMoniker_Release(window->mon); - window->mon = NULL; - } + unlink_ref(&window->mon); }
HRESULT channelbsc_load_stream(HTMLInnerWindow *pending_window, IMoniker *mon, IStream *stream) diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c index 95c07c90390..21ddb3cb38f 100644 --- a/dlls/mshtml/nsembed.c +++ b/dlls/mshtml/nsembed.c @@ -1217,15 +1217,8 @@ void setup_editor_controller(GeckoBrowser *This) nsIControllerContext *ctrlctx; nsresult nsres;
- if(This->editor) { - nsIEditor_Release(This->editor); - This->editor = NULL; - } - - if(This->editor_controller) { - nsIController_Release(This->editor_controller); - This->editor_controller = NULL; - } + unlink_ref(&This->editor); + unlink_ref(&This->editor_controller);
nsres = get_nsinterface((nsISupports*)This->webbrowser, &IID_nsIEditingSession, (void**)&editing_session); diff --git a/dlls/mshtml/nsevents.c b/dlls/mshtml/nsevents.c index 90d4bc9e9bd..76a3f4ab4c6 100644 --- a/dlls/mshtml/nsevents.c +++ b/dlls/mshtml/nsevents.c @@ -293,10 +293,7 @@ static void handle_docobj_load(HTMLDocumentObj *doc) IOleCommandTarget *olecmd = NULL; HRESULT hres;
- if(doc->nscontainer->editor_controller) { - nsIController_Release(doc->nscontainer->editor_controller); - doc->nscontainer->editor_controller = NULL; - } + unlink_ref(&doc->nscontainer->editor_controller);
if(doc->nscontainer->usermode == EDITMODE) setup_editor_controller(doc->nscontainer); diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c index 6bd9a408037..c0e0e2e9f5d 100644 --- a/dlls/mshtml/nsio.c +++ b/dlls/mshtml/nsio.c @@ -1246,10 +1246,7 @@ static nsresult NSAPI nsChannel_SetReferrerWithPolicy(nsIHttpChannel *iface, nsI if(aReferrerPolicy) FIXME("refferer policy %d not implemented\n", aReferrerPolicy);
- if(This->referrer) { - nsIURI_Release(This->referrer); - This->referrer = NULL; - } + unlink_ref(&This->referrer); if(!aReferrer) return NS_OK;
@@ -2283,42 +2280,13 @@ static nsresult NSAPI nsChannel_unlink(void *p)
TRACE("%p\n", This);
- if(This->owner) { - nsISupports *owner = This->owner; - This->owner = NULL; - nsISupports_Release(owner); - } - if(This->post_data_stream) { - nsIInputStream *post_data_stream = This->post_data_stream; - This->post_data_stream = NULL; - nsIInputStream_Release(post_data_stream); - } - if(This->load_info) { - nsISupports *load_info = This->load_info; - This->load_info = NULL; - nsISupports_Release(load_info); - } - if(This->load_group) { - nsILoadGroup *load_group = This->load_group; - This->load_group = NULL; - nsILoadGroup_Release(load_group); - } - if(This->notif_callback) { - nsIInterfaceRequestor *notif_callback = This->notif_callback; - This->notif_callback = NULL; - nsIInterfaceRequestor_Release(notif_callback); - } - if(This->original_uri) { - nsIURI *original_uri = This->original_uri; - This->original_uri = NULL; - nsIURI_Release(original_uri); - } - if(This->referrer) { - nsIURI *referrer = This->referrer; - This->referrer = NULL; - nsIURI_Release(referrer); - } - + unlink_ref(&This->owner); + unlink_ref(&This->post_data_stream); + unlink_ref(&This->load_info); + unlink_ref(&This->load_group); + unlink_ref(&This->notif_callback); + unlink_ref(&This->original_uri); + unlink_ref(&This->referrer); return NS_OK; }
@@ -2338,14 +2306,6 @@ static void NSAPI nsChannel_delete_cycle_collectable(void *p) free(This); }
-static void invalidate_uri(nsWineURI *This) -{ - if(This->uri) { - IUri_Release(This->uri); - This->uri = NULL; - } -} - static BOOL ensure_uri_builder(nsWineURI *This) { if(!This->is_mutable) { @@ -2366,7 +2326,7 @@ static BOOL ensure_uri_builder(nsWineURI *This) } }
- invalidate_uri(This); + unlink_ref(&This->uri); return TRUE; }
@@ -2501,11 +2461,8 @@ static nsresult NSAPI nsURI_SetSpec(nsIFileURL *iface, const nsACString *aSpec) return NS_ERROR_FAILURE; }
- invalidate_uri(This); - if(This->uri_builder) { - IUriBuilder_Release(This->uri_builder); - This->uri_builder = NULL; - } + unlink_ref(&This->uri); + unlink_ref(&This->uri_builder);
This->uri = uri; return NS_OK; diff --git a/dlls/mshtml/oleobj.c b/dlls/mshtml/oleobj.c index c01c18b5fa8..870500ff0ab 100644 --- a/dlls/mshtml/oleobj.c +++ b/dlls/mshtml/oleobj.c @@ -448,41 +448,17 @@ static HRESULT WINAPI DocObjOleObject_SetClientSite(IOleObject *iface, IOleClien if(pClientSite == This->client) return S_OK;
- if(This->client) { - IOleClientSite_Release(This->client); - This->client = NULL; + if(This->client) This->nscontainer->usermode = UNKNOWN_USERMODE; - } - - if(This->client_cmdtrg) { - IOleCommandTarget_Release(This->client_cmdtrg); - This->client_cmdtrg = NULL; - } - - if(This->hostui && !This->custom_hostui) { - IDocHostUIHandler_Release(This->hostui); - This->hostui = NULL; - } - - if(This->doc_object_service) { - IDocObjectService_Release(This->doc_object_service); - This->doc_object_service = NULL; - } - - if(This->webbrowser) { - IUnknown_Release(This->webbrowser); - This->webbrowser = NULL; - } - - if(This->browser_service) { - IUnknown_Release(This->browser_service); - This->browser_service = NULL; - }
- if(This->travel_log) { - ITravelLog_Release(This->travel_log); - This->travel_log = NULL; - } + unlink_ref(&This->client); + unlink_ref(&This->client_cmdtrg); + if(!This->custom_hostui) + unlink_ref(&This->hostui); + unlink_ref(&This->doc_object_service); + unlink_ref(&This->webbrowser); + unlink_ref(&This->browser_service); + unlink_ref(&This->travel_log);
memset(&This->hostinfo, 0, sizeof(DOCHOSTUIINFO));
@@ -1617,11 +1593,7 @@ static HRESULT WINAPI DocObjOleInPlaceObjectWindowless_InPlaceDeactivate(IOleInP if(!This->in_place_active) return S_OK;
- if(This->frame) { - IOleInPlaceFrame_Release(This->frame); - This->frame = NULL; - } - + unlink_ref(&This->frame); if(This->hwnd) { ShowWindow(This->hwnd, SW_HIDE); SetWindowPos(This->hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); diff --git a/dlls/mshtml/persist.c b/dlls/mshtml/persist.c index b1ec172f912..bea2ab65750 100644 --- a/dlls/mshtml/persist.c +++ b/dlls/mshtml/persist.c @@ -75,16 +75,8 @@ static void notify_travellog_update(HTMLDocumentObj *doc)
void set_current_uri(HTMLOuterWindow *window, IUri *uri) { - if(window->uri) { - IUri_Release(window->uri); - window->uri = NULL; - } - - if(window->uri_nofrag) { - IUri_Release(window->uri_nofrag); - window->uri_nofrag = NULL; - } - + unlink_ref(&window->uri); + unlink_ref(&window->uri_nofrag); SysFreeString(window->url); window->url = NULL;
diff --git a/dlls/mshtml/pluginhost.c b/dlls/mshtml/pluginhost.c index c81c17690ac..f910600de18 100644 --- a/dlls/mshtml/pluginhost.c +++ b/dlls/mshtml/pluginhost.c @@ -1515,15 +1515,8 @@ static ULONG WINAPI PHClientSite_AddRef(IOleClientSite *iface)
static void release_plugin_ifaces(PluginHost *This) { - if(This->disp) { - IDispatch_Release(This->disp); - This->disp = NULL; - } - - if(This->ip_object) { - IOleInPlaceObject_Release(This->ip_object); - This->ip_object = NULL; - } + unlink_ref(&This->disp); + unlink_ref(&This->ip_object);
if(This->plugin_unk) { IUnknown *unk = This->plugin_unk; @@ -1970,11 +1963,7 @@ static HRESULT WINAPI PHInPlaceSite_OnInPlaceDeactivate(IOleInPlaceSiteEx *iface
TRACE("(%p)\n", This);
- if(This->ip_object) { - IOleInPlaceObject_Release(This->ip_object); - This->ip_object = NULL; - } - + unlink_ref(&This->ip_object); return S_OK; }
diff --git a/dlls/mshtml/script.c b/dlls/mshtml/script.c index 0cd79b45405..ad44a1ace41 100644 --- a/dlls/mshtml/script.c +++ b/dlls/mshtml/script.c @@ -257,15 +257,8 @@ static void release_script_engine(ScriptHost *This) IActiveScript_Close(This->script);
default: - if(This->parse_proc) { - IActiveScriptParseProcedure2_Release(This->parse_proc); - This->parse_proc = NULL; - } - - if(This->parse) { - IActiveScriptParse_Release(This->parse); - This->parse = NULL; - } + unlink_ref(&This->parse_proc); + unlink_ref(&This->parse); }
IActiveScript_Release(This->script); diff --git a/dlls/mshtml/view.c b/dlls/mshtml/view.c index 3f31e609e39..43ebc5284f5 100644 --- a/dlls/mshtml/view.c +++ b/dlls/mshtml/view.c @@ -619,10 +619,7 @@ static HRESULT WINAPI OleDocumentView_Show(IOleDocumentView *iface, BOOL fShow) if(This->in_place_active) IOleInPlaceObjectWindowless_InPlaceDeactivate(&This->IOleInPlaceObjectWindowless_iface);
- if(This->ip_window) { - IOleInPlaceUIWindow_Release(This->ip_window); - This->ip_window = NULL; - } + unlink_ref(&This->ip_window); }
return S_OK;