Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/web_ui/lib/src/engine/canvaskit/text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ class CkParagraph extends SkiaObject<SkParagraph> implements ui.Paragraph {

@override
void delete() {
_skParagraph!.delete();
_skParagraph?.delete();
}

@override
Expand Down
12 changes: 12 additions & 0 deletions lib/web_ui/test/canvaskit/canvaskit_api_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1342,6 +1342,18 @@ void _canvasTests() {
);
});

test('Paragraph dispose', () {
final CkParagraphBuilder builder = CkParagraphBuilder(
CkParagraphStyle(),
);
builder.addText('Hello');
final CkParagraph paragraph = builder.build();

paragraph.delete();
paragraph.dispose();
expect(paragraph.debugDisposed, true);
});

test('toImage.toByteData', () async {
// Pretend that FinalizationRegistry is supported, so we can run this
// test in older browsers (the test will use a TestCollector instead of
Expand Down