mshtml: Make sure we have associated listener before calling OnStopRequest.

This commit is contained in:
Jacek Caban 2007-07-26 00:14:45 +02:00 committed by Alexandre Julliard
parent 262db80776
commit cb9527ac06
1 changed files with 10 additions and 7 deletions

View File

@ -249,6 +249,12 @@ static void add_nsrequest(BSCallback *This)
} }
} }
static void on_stop_nsrequest(BSCallback *This) {
if(This->nslistener)
nsIStreamListener_OnStopRequest(This->nslistener, (nsIRequest*)NSCHANNEL(This->nschannel),
This->nscontext, NS_OK);
}
#define STATUSCLB_THIS(iface) DEFINE_THIS(BSCallback, BindStatusCallback, iface) #define STATUSCLB_THIS(iface) DEFINE_THIS(BSCallback, BindStatusCallback, iface)
static HRESULT WINAPI BindStatusCallback_QueryInterface(IBindStatusCallback *iface, static HRESULT WINAPI BindStatusCallback_QueryInterface(IBindStatusCallback *iface,
@ -391,10 +397,9 @@ static HRESULT WINAPI BindStatusCallback_OnStopBinding(IBindStatusCallback *ifac
This->binding = NULL; This->binding = NULL;
} }
if(This->nslistener) { on_stop_nsrequest(This);
nsIStreamListener_OnStopRequest(This->nslistener, (nsIRequest*)NSCHANNEL(This->nschannel),
This->nscontext, NS_OK);
if(This->nslistener) {
if(This->nschannel->load_group) { if(This->nschannel->load_group) {
nsresult nsres; nsresult nsres;
@ -796,8 +801,7 @@ HRESULT start_binding(BSCallback *bscallback)
hres = CreateAsyncBindCtx(0, STATUSCLB(bscallback), NULL, &bctx); hres = CreateAsyncBindCtx(0, STATUSCLB(bscallback), NULL, &bctx);
if(FAILED(hres)) { if(FAILED(hres)) {
WARN("CreateAsyncBindCtx failed: %08x\n", hres); WARN("CreateAsyncBindCtx failed: %08x\n", hres);
nsIStreamListener_OnStopRequest(bscallback->nslistener, (nsIRequest*)NSCHANNEL(bscallback->nschannel), on_stop_nsrequest(bscallback);
bscallback->nscontext, NS_OK);
return hres; return hres;
} }
@ -805,8 +809,7 @@ HRESULT start_binding(BSCallback *bscallback)
IBindCtx_Release(bctx); IBindCtx_Release(bctx);
if(FAILED(hres)) { if(FAILED(hres)) {
WARN("BindToStorage failed: %08x\n", hres); WARN("BindToStorage failed: %08x\n", hres);
nsIStreamListener_OnStopRequest(bscallback->nslistener, (nsIRequest*)NSCHANNEL(bscallback->nschannel), on_stop_nsrequest(bscallback);
bscallback->nscontext, NS_OK);
return hres; return hres;
} }