Reset ParagraphBuilder after build() (flutter/engine#7401)
* Reset ParagraphBuilder after build()
This commit is contained in:
@@ -17,4 +17,11 @@ void main() {
|
||||
expect(paragraph.width, isNonZero);
|
||||
expect(paragraph.height, isNonZero);
|
||||
});
|
||||
|
||||
test('PushStyle should not segfault after build()', () {
|
||||
final ParagraphBuilder paragraphBuilder =
|
||||
ParagraphBuilder(ParagraphStyle());
|
||||
paragraphBuilder.build();
|
||||
paragraphBuilder.pushStyle(TextStyle());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -84,6 +84,7 @@ std::unique_ptr<Paragraph> ParagraphBuilder::Build() {
|
||||
paragraph->SetText(std::move(text_), std::move(runs_));
|
||||
paragraph->SetParagraphStyle(paragraph_style_);
|
||||
paragraph->SetFontCollection(font_collection_);
|
||||
SetParagraphStyle(paragraph_style_);
|
||||
return paragraph;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user