From 336fa49f2b2a17d30c8f1a632e7e4d1ee796b56b Mon Sep 17 00:00:00 2001 From: "bzbarsky@mit.edu" Date: Thu, 20 Mar 2008 23:13:11 -0700 Subject: [PATCH] Hold strong ref to ourselves so we don't die while touching members. Bug 421602 followup, r= and a= pending --- modules/libpr0n/src/imgRequestProxy.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/libpr0n/src/imgRequestProxy.cpp b/modules/libpr0n/src/imgRequestProxy.cpp index d471508d4a6..0c6e07b70cd 100644 --- a/modules/libpr0n/src/imgRequestProxy.cpp +++ b/modules/libpr0n/src/imgRequestProxy.cpp @@ -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 kungFuDeathGrip(this); if (mListener) { // Hold a ref to the listener while we call it, just in case.