Bug 369690: nsPresContext::mImageLoaders uses wrong key; r+sr=bzbarsky

This commit is contained in:
sharparrow1%yahoo.com 2007-02-09 20:44:10 +00:00
Родитель bc3226ce06
Коммит 1436342d23
3 изменённых файлов: 12 добавлений и 7 удалений

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

@ -144,7 +144,7 @@ IsVisualCharset(const nsCString& aCharset)
PR_STATIC_CALLBACK(PLDHashOperator) PR_STATIC_CALLBACK(PLDHashOperator)
destroy_loads(const PRUint32& aKey, nsCOMPtr<nsImageLoader>& aData, void* closure) destroy_loads(const void * aKey, nsCOMPtr<nsImageLoader>& aData, void* closure)
{ {
aData->Destroy(); aData->Destroy();
return PL_DHASH_NEXT; return PL_DHASH_NEXT;
@ -915,7 +915,7 @@ static void SetImgAnimModeOnImgReq(imgIRequest* aImgReq, PRUint16 aMode)
// Enumeration call back for HashTable // Enumeration call back for HashTable
PR_STATIC_CALLBACK(PLDHashOperator) PR_STATIC_CALLBACK(PLDHashOperator)
set_animation_mode(const PRUint32& aKey, nsCOMPtr<nsImageLoader>& aData, void* closure) set_animation_mode(const void * aKey, nsCOMPtr<nsImageLoader>& aData, void* closure)
{ {
imgIRequest* imgReq = aData->GetRequest(); imgIRequest* imgReq = aData->GetRequest();
SetImgAnimModeOnImgReq(imgReq, (PRUint16)NS_PTR_TO_INT32(closure)); SetImgAnimModeOnImgReq(imgReq, (PRUint16)NS_PTR_TO_INT32(closure));
@ -1046,7 +1046,7 @@ nsPresContext::LoadImage(imgIRequest* aImage, nsIFrame* aTargetFrame)
{ {
// look and see if we have a loader for the target frame. // look and see if we have a loader for the target frame.
nsCOMPtr<nsImageLoader> loader; nsCOMPtr<nsImageLoader> loader;
mImageLoaders.Get(NS_PTR_TO_INT32(aTargetFrame), getter_AddRefs(loader)); mImageLoaders.Get(aTargetFrame, getter_AddRefs(loader));
if (!loader) { if (!loader) {
loader = new nsImageLoader(); loader = new nsImageLoader();
@ -1054,7 +1054,7 @@ nsPresContext::LoadImage(imgIRequest* aImage, nsIFrame* aTargetFrame)
return nsnull; return nsnull;
loader->Init(aTargetFrame, this); loader->Init(aTargetFrame, this);
mImageLoaders.Put(NS_PTR_TO_INT32(aTargetFrame), loader); mImageLoaders.Put(aTargetFrame, loader);
} }
loader->Load(aImage); loader->Load(aImage);
@ -1069,12 +1069,12 @@ void
nsPresContext::StopImagesFor(nsIFrame* aTargetFrame) nsPresContext::StopImagesFor(nsIFrame* aTargetFrame)
{ {
nsCOMPtr<nsImageLoader> loader; nsCOMPtr<nsImageLoader> loader;
mImageLoaders.Get(NS_PTR_TO_INT32(aTargetFrame), getter_AddRefs(loader)); mImageLoaders.Get(aTargetFrame, getter_AddRefs(loader));
if (loader) { if (loader) {
loader->Destroy(); loader->Destroy();
mImageLoaders.Remove(NS_PTR_TO_INT32(aTargetFrame)); mImageLoaders.Remove(aTargetFrame);
} }
} }

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

@ -747,7 +747,7 @@ protected:
nsILinkHandler* mLinkHandler; // [WEAK] nsILinkHandler* mLinkHandler; // [WEAK]
nsIAtom* mLangGroup; // [STRONG] nsIAtom* mLangGroup; // [STRONG]
nsInterfaceHashtable<nsUint32HashKey, nsImageLoader> mImageLoaders; nsInterfaceHashtable<nsVoidPtrHashKey, nsImageLoader> mImageLoaders;
nsWeakPtr mContainer; nsWeakPtr mContainer;
// Only used in the root prescontext (this->RootPresContext() == this) // Only used in the root prescontext (this->RootPresContext() == this)

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

@ -59,9 +59,14 @@
* nsStringHashKey * nsStringHashKey
* nsCStringHashKey * nsCStringHashKey
* nsUint32HashKey * nsUint32HashKey
* nsVoidPtrHashKey
* nsClearingVoidPtrHashKey
* nsISupportsHashKey * nsISupportsHashKey
* nsIDHashKey * nsIDHashKey
* nsDepCharHashKey * nsDepCharHashKey
* nsCharPtrHashKey
* nsUnicharPtrHashKey
* nsHashableHashKey
*/ */
NS_COM_GLUE PRUint32 HashString(const nsAString& aStr); NS_COM_GLUE PRUint32 HashString(const nsAString& aStr);