/// <summary> /// Disposing this instance is special - we must not dispose the reference this instance holds. /// Instead, we remove all references to the holded document node and also all event handlers- /// </summary> /// <param name="isDisposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> protected override void Dispose(bool isDisposing) { if (null != _weakDocNodeChangedHandler) { _weakDocNodeChangedHandler.Remove(); _weakDocNodeChangedHandler = null; } if (null != _weakDocNodeTunneledEventHandler) { _weakDocNodeTunneledEventHandler.Remove(); _weakDocNodeTunneledEventHandler = null; } _docNodeRef = null; #if DEBUG_DOCNODEPROXYLOGGING Current.Console.WriteLine("DocNodeProxy.Dispose, path was >>>{0}<<<", _docNodePath); #endif _docNodePath = null; base.Dispose(isDisposing); }
/// <summary> /// Sets the document node to null, but keeps the doc node path. /// </summary> protected void ClearDocNode() { if (_docNodeRef == null) { return; } OnBeforeClearDocNode(); if (null != _weakDocNodeTunneledEventHandler) { _weakDocNodeTunneledEventHandler.Remove(); _weakDocNodeTunneledEventHandler = null; } if (null != _weakDocNodeChangedHandler) { _weakDocNodeChangedHandler.Remove(); _weakDocNodeChangedHandler = null; } _docNodeRef = null; }