DisposableOpenCVObject.cs 1012 B

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