Closed sysmesh closed 1 month ago
Well it's so strange...
vec should be copied when creating Mat with Mat.fromVec
, and thus safe to dispose.
Wait, do you use docCnt
after openCV.Mat.fromVec(docCnt!);
? if so it makes sense.
Anyway, I realized that vec should not be freed inside Mat.fromVec
, will fix it.
Thanks for your debugging. :)
The actual crash happens right when the dispose is called (way before it finishes the function) so I am not trying to use doCnt :-)
Describe the bug When using a VecPoint pointer when calling Mat.fromVec the code crashes without notice or any error log. After debugging the code I've discovered that in core/Mat.php line 161 the dispose causes dart to crash. If you comment it out then the code runs fine without an error.
To Reproduce Steps to reproduce the behavior:
In your code create and populate a Vec type: openCV.Vec? docCnt;
Then try to create a Mat from that vec type: openCV.Mat docCntMat = openCV.Mat.fromVec(docCnt!);
On iOS (checked on simulator and on a physical device - it will cause a crash.
Expected behavior Expected a Mat to be created or a proper thrown exception.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context If you comment out line 161 at core/mat.dart it will work fine: //vec.dispose(); return Mat._(p);