Bug 1846293 - Improve flush handing in Canvas2D. r=dholbert

Don't keep weak pointers before flushing.

Differential Revision: https://phabricator.services.mozilla.com/D184950
This commit is contained in:
Emilio Cobos Álvarez 2023-07-31 16:48:09 +00:00
Родитель 91eaf8a22f
Коммит e6cea60db2
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -4462,14 +4462,14 @@ TextMetrics* CanvasRenderingContext2D::DrawOrMeasureText(
const nsAString& aRawText, float aX, float aY,
const Optional<double>& aMaxWidth, TextDrawOperation aOp,
ErrorResult& aError) {
gfxFontGroup* currentFontStyle = GetCurrentFontStyle();
RefPtr<gfxFontGroup> currentFontStyle = GetCurrentFontStyle();
if (NS_WARN_IF(!currentFontStyle)) {
aError = NS_ERROR_FAILURE;
return nullptr;
}
RefPtr<PresShell> presShell = GetPresShell();
Document* document = presShell ? presShell->GetDocument() : nullptr;
RefPtr<Document> document = presShell ? presShell->GetDocument() : nullptr;
// replace all the whitespace characters with U+0020 SPACE
nsAutoString textToDraw(aRawText);