Skip to content

Commit

Permalink
Reset ParagraphBuilder after build() (flutter#7401)
Browse files Browse the repository at this point in the history
* Reset ParagraphBuilder after build()
  • Loading branch information
dnfield authored Jan 8, 2019
1 parent 4820cbe commit 4036b26
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions testing/dart/paragraph_builder_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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());
});
}
1 change: 1 addition & 0 deletions third_party/txt/src/txt/paragraph_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 4036b26

Please sign in to comment.