rainyl / opencv_dart

OpenCV bindings for Dart language and Flutter.
https://pub.dev/packages/opencv_dart
Apache License 2.0
78 stars 10 forks source link

VecUChar.toU8List() cause unexpected crash #85

Closed rainyl closed 2 weeks ago

rainyl commented 3 weeks ago

Describe the bug from 1.0.5+1, VecUChar.data was added and will return a view of native data, and toU8List() is an alias of data, but in some cases, users may want to get a full copy of data, e.g., run some tasks in an isolate and return encoded data as Uint8List, but if return VecUChar.data directly, native resources will be freed after the isolate exit, so the returned view will be invalid.

To solve this, toU8List will return a full copy of native data.