Beispiel #1
0
 public void AssertReady()
 {
     if (HasError)
     {
         throw ImageflowException.FromContext(this);
     }
 }
Beispiel #2
0
        protected virtual void Dispose(bool disposing)
        {
            if (_ptr == IntPtr.Zero)
            {
                return;
            }

            if (disposing)
            {
                // Free managed objects
            }

            Exception e = null;

            if (!NativeMethods.imageflow_context_begin_terminate(_ptr))
            {
                e = ImageflowException.FromContext(this);
            }
            NativeMethods.imageflow_context_destroy(_ptr);
            _ptr = IntPtr.Zero;

            //Unpin all managed data held for context lifetime
            if (_pinned != null)
            {
                foreach (var active in _pinned)
                {
                    active.Free();
                }
            }

            if (e != null)
            {
                throw e;
            }
        }
Beispiel #3
0
        protected virtual void Dispose(bool disposing)
        {
            if (_ptr == IntPtr.Zero)
            {
                return;
            }

            if (disposing)
            {
                // Free managed objects
            }

            // Disposing the context also disposes the jobs
            if (!_parent.IsDisposed)
            {
                if (!NativeMethods.imageflow_json_response_destroy(_parent.Pointer, _ptr))
                {
                    _ptr = IntPtr.Zero;
                    throw ImageflowException.FromContext(_parent);
                }
            }
            _ptr = IntPtr.Zero;
        }