mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Fixed to handle destroy callbacks better to unwind connections to image lib
This commit is contained in:
parent
6305617dfe
commit
b556d2e592
@ -125,7 +125,9 @@ nsrefcnt ImageRequestImpl::Release(void)
|
||||
// Make sure dangling reference to this object goes away
|
||||
XP_RemoveObserver(mXPObserver, ns_observer_proc, (void*)this);
|
||||
}
|
||||
IL_DestroyImage(mImageReq);
|
||||
if (mImageReq) {
|
||||
IL_DestroyImage(mImageReq);
|
||||
}
|
||||
NS_DELETEXPCOM(this);
|
||||
return 0;
|
||||
}
|
||||
@ -346,7 +348,19 @@ static void ns_observer_proc (XP_Observable aSource,
|
||||
*/
|
||||
if ((IL_IMAGE_DESTROYED == aMsg) && (nsnull != image_request)) {
|
||||
image_request->SetImageRequest(nsnull);
|
||||
image_request->ImageDestroyed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ImageRequestImpl::ImageDestroyed()
|
||||
{
|
||||
if (mXPObserver) {
|
||||
// Make sure dangling reference to this object goes
|
||||
// away; this is just in case the image library changes
|
||||
// and holds onto the observer list after destroying the
|
||||
// image.
|
||||
XP_RemoveObserver(mXPObserver, ns_observer_proc, (void*)this);
|
||||
mXPObserver = nsnull;
|
||||
}
|
||||
}
|
||||
|
@ -58,10 +58,13 @@ public:
|
||||
// Interrupt loading of just this image.
|
||||
virtual void Interrupt();
|
||||
|
||||
// XXX These should go: fix ns_observer_proc to be a static method
|
||||
IL_ImageReq *GetImageRequest() { return mImageReq; }
|
||||
void SetImageRequest(IL_ImageReq *aImageReq) { mImageReq = aImageReq; }
|
||||
nsVoidArray *GetObservers() { return mObservers; }
|
||||
|
||||
void ImageDestroyed();
|
||||
|
||||
private:
|
||||
IL_ImageReq *mImageReq;
|
||||
IL_GroupContext *mGroupContext;
|
||||
|
Loading…
Reference in New Issue
Block a user