Commit 220755d
Add OpenCvSafeHandle.Null and migrate optional mask/control arguments to it
Every extern that already used a SafeHandle for its own "this" handle
still fell back to a plain IntPtr (and a manual GC.KeepAlive) for
optional arguments referencing another native object, since there was
no way to express "no handle" through a SafeHandle-typed parameter.
OpenCvSafeHandle.Null (a non-owning handle wrapping a null pointer)
closes that gap.
Migrated: LSDDetector.Detect(mask), FeaturesMatcher.Apply(mask),
KalmanFilter.Predict(control), Mat/UMat.SetTo(mask),
FileNode.ReadMat/ReadSparseMat(defaultValue). Each now passes
`x?.Handle ?? OpenCvSafeHandle.Null` and drops the now-redundant
GC.KeepAlive for that argument. Added KalmanTest.PredictWithoutControl/
PredictWithControl since Predict() previously had no test coverage.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent 87c8d92 commit 220755d
14 files changed
Lines changed: 52 additions & 30 deletions
File tree
- src/OpenCvSharp
- Fundamentals
- Internal/PInvoke/NativeMethods
- core
- stitching
- video
- Modules
- core
- Mat
- line_descriptors
- stitching
- video
- test/OpenCvSharp.Tests/video
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
47 | 54 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
| 83 | + | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
512 | 512 | | |
513 | 513 | | |
514 | 514 | | |
515 | | - | |
516 | | - | |
| 515 | + | |
517 | 516 | | |
518 | 517 | | |
519 | 518 | | |
| |||
534 | 533 | | |
535 | 534 | | |
536 | 535 | | |
537 | | - | |
538 | | - | |
| 536 | + | |
539 | 537 | | |
540 | 538 | | |
541 | 539 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1350 | 1350 | | |
1351 | 1351 | | |
1352 | 1352 | | |
1353 | | - | |
1354 | 1353 | | |
1355 | | - | |
| 1354 | + | |
1356 | 1355 | | |
1357 | | - | |
1358 | 1356 | | |
1359 | 1357 | | |
1360 | 1358 | | |
| |||
1368 | 1366 | | |
1369 | 1367 | | |
1370 | 1368 | | |
1371 | | - | |
1372 | 1369 | | |
1373 | | - | |
| 1370 | + | |
1374 | 1371 | | |
1375 | 1372 | | |
1376 | | - | |
1377 | 1373 | | |
1378 | 1374 | | |
1379 | 1375 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
769 | 769 | | |
770 | 770 | | |
771 | 771 | | |
772 | | - | |
773 | 772 | | |
774 | | - | |
| 773 | + | |
775 | 774 | | |
776 | | - | |
777 | 775 | | |
778 | 776 | | |
779 | 777 | | |
| |||
787 | 785 | | |
788 | 786 | | |
789 | 787 | | |
790 | | - | |
791 | 788 | | |
792 | | - | |
| 789 | + | |
793 | 790 | | |
794 | 791 | | |
795 | | - | |
796 | 792 | | |
797 | 793 | | |
798 | 794 | | |
| |||
0 commit comments