示例#1
0
        /// <summary>
        /// Releases the unmanaged resources used by this <see cref="BroEvent"/> object and optionally releases the managed resources.
        /// </summary>
        /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
        protected virtual void Dispose(bool disposing)
        {
            if (!m_disposed)
            {
                try
                {
#if USE_SAFE_HANDLES
                    if ((object)m_eventPtr != null && !m_eventPtr.IsInvalid())
                    {
                        m_eventPtr.Dispose();
                    }
#else
                    if (m_eventPtr != IntPtr.Zero)
                    {
                        BroApi.bro_event_free(m_eventPtr);
                        m_eventPtr = IntPtr.Zero;
                    }
#endif
                    if (disposing)
                    {
                        m_parameters.Clear();
                    }
                }
                finally
                {
                    m_disposed = true;  // Prevent duplicate dispose.
                }
            }
        }