DisposableOpenCVObject.cs 906 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using UnityEngine;
  2. using System;
  3. namespace OpenCVForUnity {
  4. abstract public class DisposableOpenCVObject : DisposableObject {
  5. internal IntPtr nativeObj;
  6. protected DisposableOpenCVObject()
  7. : this(true) {
  8. }
  9. protected DisposableOpenCVObject(IntPtr ptr)
  10. : this(ptr, true) {
  11. }
  12. protected DisposableOpenCVObject(bool isEnabledDispose)
  13. : this(IntPtr.Zero, isEnabledDispose) {
  14. }
  15. protected DisposableOpenCVObject(IntPtr ptr, bool isEnabledDispose)
  16. : base(isEnabledDispose) {
  17. this.nativeObj = ptr;
  18. }
  19. protected override void Dispose(bool disposing) {
  20. try {
  21. if (disposing) {
  22. }
  23. nativeObj = IntPtr.Zero;
  24. } finally {
  25. base.Dispose(disposing);
  26. }
  27. }
  28. }
  29. }