diff --git a/gfx/src/os2/nsImageOS2.cpp b/gfx/src/os2/nsImageOS2.cpp index 102a2126f09..cac7e9e9691 100644 --- a/gfx/src/os2/nsImageOS2.cpp +++ b/gfx/src/os2/nsImageOS2.cpp @@ -366,9 +366,9 @@ nsImageOS2 :: Draw(nsIRenderingContext &aContext, nsIDrawingSurface* aSurface, { aSX + aSWidth, mInfo->cy - aSY } }; // SUR PRBool fPrinting = PR_FALSE; - nsIDeviceContext* context; - aContext.GetDeviceContext(context); - if (((nsDeviceContextOS2 *)context)->mPrintDC) { + nsCOMPtr context; + aContext.GetDeviceContext(*getter_AddRefs(context)); + if (((nsDeviceContextOS2 *)context.get())->mPrintDC) { fPrinting = PR_TRUE; } @@ -738,9 +738,9 @@ NS_IMETHODIMP nsImageOS2::DrawTile(nsIRenderingContext &aContext, PRBool padded = (aPadX || aPadY); // Get the scale - if greater than 1 then do slow tile which - nsIDeviceContext *theDeviceContext; + nsCOMPtr theDeviceContext; float scale; - aContext.GetDeviceContext(theDeviceContext); + aContext.GetDeviceContext(*getter_AddRefs(theDeviceContext)); theDeviceContext->GetCanonicalPixelScale(scale); nsRect ValidRect (0, 0, ImageWidth, ImageHeight); diff --git a/gfx/tests/coverage/nsCoverage.cpp b/gfx/tests/coverage/nsCoverage.cpp index 5ac783a33e2..9bfd02dafb3 100644 --- a/gfx/tests/coverage/nsCoverage.cpp +++ b/gfx/tests/coverage/nsCoverage.cpp @@ -94,11 +94,10 @@ nsFont *font; nsPoint *pointlist; // Get the size of a pixel. - nsIDeviceContext* deviceContext; - aSurface->GetDeviceContext(deviceContext); + nsCOMPtr deviceContext; + aSurface->GetDeviceContext(*getter_AddRefs(deviceContext)); float p2t; // pixel to twips conversion p2t = deviceContext->DevUnitsToAppUnits(); - NS_RELEASE(deviceContext); font = new nsFont("Times", NS_FONT_STYLE_NORMAL,NS_FONT_VARIANT_NORMAL,NS_FONT_WEIGHT_BOLD,0,12); aSurface->SetFont(*font); diff --git a/widget/src/xpwidgets/nsBaseWidget.cpp b/widget/src/xpwidgets/nsBaseWidget.cpp index f75c7f6715b..c5701c5cfb7 100644 --- a/widget/src/xpwidgets/nsBaseWidget.cpp +++ b/widget/src/xpwidgets/nsBaseWidget.cpp @@ -653,7 +653,6 @@ nsIToolkit* nsBaseWidget::GetToolkit() //------------------------------------------------------------------------- nsIDeviceContext* nsBaseWidget::GetDeviceContext() { - NS_IF_ADDREF(mContext); return mContext; }