tags 321644 +patch
tags 336441 +patch
thanks

On Sun, Oct 30, 2005 at 02:40:47PM +0100, Lionel Elie Mamane wrote:
> On Sun, Oct 30, 2005 at 02:19:34PM +0100, Lionel Elie Mamane wrote:

>> At this point, this may be a dupe of #321644. Recompiling Mozilla to
>> test it.

> Yup, compiling with "-O" instead of "-g -O2" solves it, so this seems
> to be a dupe of #321644.

> Further comment, though: Please look at
>  https://bugzilla.mozilla.org/show_bug.cgi?id=293307
>  https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=160330
>  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11376
> This seems to be a bug in *Mozilla* (aliasing violation) which is
> triggered only when compiling with -O2 (or greater).

> In particular, https://bugzilla.mozilla.org/show_bug.cgi?id=293307
> contains a patch (which I haven't tested yet).

A slightly edited version of this patch, herewith attached, solves at
least a specific crash I was having, even when compiling with
 OPTFLAGS=-g -O2 -DDEBIAN
.

-- 
Lionel
Index: imgLoader.cpp
===================================================================
RCS file: /cvsroot/mozilla/modules/libpr0n/src/imgLoader.cpp,v
retrieving revision 1.87
diff -up -r1.87 imgLoader.cpp
--- mozilla/modules/libpr0n/src/imgLoader.cpp
+++ mozilla/modules/libpr0n/src/imgLoader.cpp
@@ -926,7 +926,7 @@ void imgCacheValidator::AddProxy(imgRequ
   // the network.
   aProxy->AddToLoadGroup();
 
-  mProxies.AppendElement(aProxy);
+  mProxies.AppendObject(aProxy);
 }
 
 /** nsIRequestObserver methods **/
@@ -939,13 +939,10 @@ NS_IMETHODIMP imgCacheValidator::OnStart
     PRBool isFromCache;
     if (NS_SUCCEEDED(cacheChan->IsFromCache(&isFromCache)) && isFromCache) {
 
-      PRUint32 count;
-      mProxies.Count(&count);
+      PRUint32 count = mProxies.Count();
       for (PRInt32 i = count-1; i>=0; i--) {
-        imgRequestProxy *proxy;
-        mProxies.GetElementAt(i, (nsISupports**)&proxy);
+        imgRequestProxy *proxy = NS_STATIC_CAST(imgRequestProxy *, 
mProxies[i]);
         mRequest->NotifyProxyListener(proxy);
-        NS_RELEASE(proxy);
       }
 
       mRequest->SetLoadId(mContext);
@@ -994,14 +991,11 @@ NS_IMETHODIMP imgCacheValidator::OnStart
 
   mDestListener = NS_STATIC_CAST(nsIStreamListener*, pl);
 
-  PRUint32 count;
-  mProxies.Count(&count);
+  PRUint32 count = mProxies.Count();
   for (PRInt32 i = count-1; i>=0; i--) {
-    imgRequestProxy *proxy;
-    mProxies.GetElementAt(i, (nsISupports**)&proxy);
+    imgRequestProxy *proxy = NS_STATIC_CAST(imgRequestProxy *, mProxies[i]);
     proxy->ChangeOwner(request);
     request->NotifyProxyListener(proxy);
-    NS_RELEASE(proxy);
   }
 
   NS_RELEASE(request);
Index: imgLoader.h
===================================================================
RCS file: /cvsroot/mozilla/modules/libpr0n/src/imgLoader.h,v
retrieving revision 1.12
diff -up -r1.12 imgLoader.h
--- mozilla/modules/libpr0n/src/imgLoader.h
+++ mozilla/modules/libpr0n/src/imgLoader.h
@@ -106,7 +106,7 @@ private:
  * validate checker
  */
 
-#include "nsSupportsArray.h"
+#include "nsCOMArray.h"
 
 class imgCacheValidator : public nsIStreamListener
 {
@@ -125,7 +125,7 @@ private:
   nsCOMPtr<nsIStreamListener> mDestListener;
 
   imgRequest *mRequest;
-  nsSupportsArray mProxies;
+  nsCOMArray<imgIRequest> mProxies;
 
   void *mContext;
 };

Reply via email to