From 74dc9a0cf465411294ca042e04bd7263943ff405 Mon Sep 17 00:00:00 2001 From: "nisheeth%netscape.com" Date: Wed, 27 Oct 1999 22:45:05 +0000 Subject: [PATCH] r=pollmann, troy. Fix for bug 10564. Added some error checking code to prevent crashes reported on low memory configurations. --- gfx/src/nsImageRequest.cpp | 6 +++++- layout/base/src/nsFrameImageLoader.cpp | 12 +++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/gfx/src/nsImageRequest.cpp b/gfx/src/nsImageRequest.cpp index d7567a70602d..ef3eaae6b723 100644 --- a/gfx/src/nsImageRequest.cpp +++ b/gfx/src/nsImageRequest.cpp @@ -33,11 +33,15 @@ static void ns_observer_proc (XP_Observable aSource, { ImageRequestImpl *image_request = (ImageRequestImpl *)aClosure; IL_MessageData *message_data = (IL_MessageData *)aMsgData; - nsVoidArray *observer_list = image_request->GetObservers(); + nsVoidArray *observer_list = nsnull; nsIImage *image = nsnull; // IL_ImageReq *il_image_req = image_request->GetImageRequest(); IL_ImageReq *il_image_req = (IL_ImageReq *)aSource; + if (image_request != nsnull) { + observer_list = image_request->GetObservers(); + } + if (il_image_req != nsnull) { IL_Pixmap *pixmap = IL_GetImagePixmap(il_image_req); diff --git a/layout/base/src/nsFrameImageLoader.cpp b/layout/base/src/nsFrameImageLoader.cpp index f8e9c323f0bb..809bb2e8058b 100644 --- a/layout/base/src/nsFrameImageLoader.cpp +++ b/layout/base/src/nsFrameImageLoader.cpp @@ -24,6 +24,7 @@ #include "nsIImageGroup.h" #include "nsIImageRequest.h" #include "nsIStyleContext.h" +#include "nsCOMPtr.h" #ifdef DEBUG #undef NOISY_IMAGE_LOADING @@ -548,11 +549,12 @@ nsFrameImageLoader::DamageRepairFrames(const nsRect* aDamageRect) bounds.y += offset.y; } - nsIViewManager* vm; - view->GetViewManager(vm); - vm->UpdateView(view, bounds, NS_VMREFRESH_NO_SYNC); - NS_RELEASE(vm); - + nsCOMPtr vm = nsnull; + nsresult rv = NS_OK; + rv = view->GetViewManager(*getter_AddRefs(vm)); + if (NS_SUCCEEDED(rv) && nsnull != vm) { + vm->UpdateView(view, bounds, NS_VMREFRESH_NO_SYNC); + } pfd = pfd->mNext; } }