From e7bf4f0f57e25aa0ae0a6f64ad9a602cb2c9691d Mon Sep 17 00:00:00 2001 From: "troy%netscape.com" Date: Sun, 2 Aug 1998 17:04:53 +0000 Subject: [PATCH] Fixed some ref counting problems with the nsIImage --- gfx/src/nsImageRenderer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gfx/src/nsImageRenderer.cpp b/gfx/src/nsImageRenderer.cpp index 3726d0ebaf4a..e5f25c3a0d87 100644 --- a/gfx/src/nsImageRenderer.cpp +++ b/gfx/src/nsImageRenderer.cpp @@ -109,7 +109,9 @@ ImageRendererImpl::NewPixmap(void* aDisplayContext, aImage->bits = img->GetBits(); aImage->client_data = img; - NS_ADDREF(img); + // We don't need to add a reference here, because we're already holding + // a reference, because of the call above to the repository to create the + // nsIImage* aImage->header.width = aWidth; aImage->header.height = aHeight; aImage->header.widthBytes = img->GetLineStride(); @@ -117,6 +119,9 @@ ImageRendererImpl::NewPixmap(void* aDisplayContext, if (aMask) { aMask->bits = img->GetAlphaBits(); aMask->client_data = img; + // Make sure you add another reference here, because when the mask's + // pixmap is destroyed the reference will be released + NS_ADDREF(img); aMask->header.width = aWidth; aMask->header.height = aHeight; }