public void InvokeFromToken(IValueContainer valueContainer, IDisposableTreeHandleable owner) { // Disposing the owner sets _callback to null, so copy to stack first. var callback = _callback; owner.Dispose(); callback.Invoke(new ReasonContainer(valueContainer)); }
public void InvokeFromToken(IValueContainer valueContainer, IDisposableTreeHandleable owner) { // When token is canceled, don't invoke the callback. if (_valueContainer != null) { // Owner is in the event queue, just release the container. _valueContainer.Release(); _valueContainer = null; } else { _previous.Remove(owner); owner.Dispose(); } }