@@ -45,10 +45,10 @@ void Vertices::RegisterNatives(tonic::DartLibraryNatives* natives) {
4545
4646bool Vertices::init (Dart_Handle vertices_handle,
4747 SkVertices::VertexMode vertex_mode,
48- const tonic::Float32List& positions,
49- const tonic::Float32List& texture_coordinates,
50- const tonic::Int32List& colors,
51- const tonic::Uint16List& indices) {
48+ tonic::Float32List& positions,
49+ tonic::Float32List& texture_coordinates,
50+ tonic::Int32List& colors,
51+ tonic::Uint16List& indices) {
5252 UIDartState::ThrowIfUIOperationsProhibited ();
5353 uint32_t builderFlags = 0 ;
5454 if (texture_coordinates.data ()) {
@@ -76,6 +76,7 @@ bool Vertices::init(Dart_Handle vertices_handle,
7676 FML_DCHECK (positions.num_elements () == texture_coordinates.num_elements ());
7777 DecodePoints (texture_coordinates, builder.texCoords ());
7878 }
79+
7980 if (colors.data ()) {
8081 // SkVertices::Builder assumes equal numbers of elements
8182 FML_DCHECK (positions.num_elements () / 2 == colors.num_elements ());
@@ -87,6 +88,11 @@ bool Vertices::init(Dart_Handle vertices_handle,
8788 builder.indices ());
8889 }
8990
91+ positions.Release ();
92+ texture_coordinates.Release ();
93+ colors.Release ();
94+ indices.Release ();
95+
9096 auto vertices = fml::MakeRefCounted<Vertices>();
9197 vertices->vertices_ = builder.detach ();
9298 vertices->AssociateWithDartWrapper (vertices_handle);
0 commit comments