diff --git a/layout/svg/nsSVGTextFrame2.cpp b/layout/svg/nsSVGTextFrame2.cpp index d11a9b516420..e3adeb2964e0 100644 --- a/layout/svg/nsSVGTextFrame2.cpp +++ b/layout/svg/nsSVGTextFrame2.cpp @@ -5481,10 +5481,12 @@ nsSVGTextFrame2::SetupInheritablePaint(gfxContext* aContext, aFillOrStroke); aTargetPaint.SetColor(color); - aContext->SetPattern(new gfxPattern(gfxRGBA(NS_GET_R(color) / 255.0, - NS_GET_G(color) / 255.0, - NS_GET_B(color) / 255.0, - NS_GET_A(color) / 255.0 * aOpacity))); + nsRefPtr pattern = + new gfxPattern(gfxRGBA(NS_GET_R(color) / 255.0, + NS_GET_G(color) / 255.0, + NS_GET_B(color) / 255.0, + NS_GET_A(color) / 255.0 * aOpacity)); + aContext->SetPattern(pattern); } }