From e6cea60db2489c8fe9a73e577509a01002fb19a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 31 Jul 2023 16:48:09 +0000 Subject: [PATCH] Bug 1846293 - Improve flush handing in Canvas2D. r=dholbert Don't keep weak pointers before flushing. Differential Revision: https://phabricator.services.mozilla.com/D184950 --- dom/canvas/CanvasRenderingContext2D.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dom/canvas/CanvasRenderingContext2D.cpp b/dom/canvas/CanvasRenderingContext2D.cpp index 3ae461e5a67b..a6778e68b8e8 100644 --- a/dom/canvas/CanvasRenderingContext2D.cpp +++ b/dom/canvas/CanvasRenderingContext2D.cpp @@ -4462,14 +4462,14 @@ TextMetrics* CanvasRenderingContext2D::DrawOrMeasureText( const nsAString& aRawText, float aX, float aY, const Optional& aMaxWidth, TextDrawOperation aOp, ErrorResult& aError) { - gfxFontGroup* currentFontStyle = GetCurrentFontStyle(); + RefPtr currentFontStyle = GetCurrentFontStyle(); if (NS_WARN_IF(!currentFontStyle)) { aError = NS_ERROR_FAILURE; return nullptr; } RefPtr presShell = GetPresShell(); - Document* document = presShell ? presShell->GetDocument() : nullptr; + RefPtr document = presShell ? presShell->GetDocument() : nullptr; // replace all the whitespace characters with U+0020 SPACE nsAutoString textToDraw(aRawText);