Skip to content

Commit

Permalink
Merge pull request #1353 from RodneyRichardson/fix-keep-alive
Browse files Browse the repository at this point in the history
Fix GC.KeepAlive() calls in EstimateAffine2D and EstimateAffinePartial2D
  • Loading branch information
shimat committed Dec 23, 2021
2 parents 5673cfd + 08572a6 commit 0eeffb1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/OpenCvSharp/Cv2/Cv2_calib3d.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3615,8 +3615,8 @@ public static double SampsonDistance(Point3d pt1, Point3d pt2, double[,] f)
from.CvPtr, to.CvPtr, ToPtr(inliers),
(int) method, ransacReprojThreshold, maxIters, confidence, refineIters, out var matPtr));

GC.KeepAlive(inliers);
GC.KeepAlive(inliers);
GC.KeepAlive(from);
GC.KeepAlive(to);
GC.KeepAlive(inliers);

return (matPtr == IntPtr.Zero) ? null : new Mat(matPtr);
Expand Down Expand Up @@ -3655,8 +3655,8 @@ public static double SampsonDistance(Point3d pt1, Point3d pt2, double[,] f)
from.CvPtr, to.CvPtr, ToPtr(inliers),
(int) method, ransacReprojThreshold, maxIters, confidence, refineIters, out var matPtr));

GC.KeepAlive(inliers);
GC.KeepAlive(inliers);
GC.KeepAlive(from);
GC.KeepAlive(to);
GC.KeepAlive(inliers);

return (matPtr == IntPtr.Zero) ? null : new Mat(matPtr);
Expand Down

0 comments on commit 0eeffb1

Please sign in to comment.