Hold strong ref to ourselves so we don't die while touching members. Bug 421602 followup, r= and a= pending

This commit is contained in:
bzbarsky@mit.edu 2008-03-20 23:13:11 -07:00
Родитель 6d3a0d05b3
Коммит 336fa49f2b
1 изменённых файлов: 4 добавлений и 0 удалений

Просмотреть файл

@ -500,6 +500,10 @@ void imgRequestProxy::OnStopRequest(nsIRequest *request, nsISupports *ctxt,
GetName(name);
LOG_FUNC_WITH_PARAM(gImgLog, "imgRequestProxy::OnStopRequest", "name", name.get());
#endif
// There's all sorts of stuff here that could kill us (the OnStopRequest call
// on the listener, the removal from the loadgroup, the release of the
// listener, etc). Don't let them do it.
nsCOMPtr<imgIRequest> kungFuDeathGrip(this);
if (mListener) {
// Hold a ref to the listener while we call it, just in case.