public Wrapper_IOleInPlaceFrame _cachedFrame; // cache the frame object returned from GetWindowContext, so that we can control the tear down public Wrapper_IOleClientSite(IntPtr hostObjectPtr) : base(hostObjectPtr) { if (hostObjectPtr != IntPtr.Zero) { _IOleClientSite = (COM_IOleClientSite)GetObject(); _IOleInPlaceSite = (COM_IOleInPlaceSite)GetObject(); } }
public override void Dispose() { _cachedFrame?.Dispose(); _cachedFrame = null; if (_IOleClientSite != null) { Marshal.ReleaseComObject(_IOleClientSite); _IOleClientSite = null; } if (_IOleInPlaceSite != null) { Marshal.ReleaseComObject(_IOleInPlaceSite); _IOleInPlaceSite = null; } base.Dispose(); }
protected override void Dispose(bool disposing) { if (disposing) { _cachedFrame?.Dispose(); _cachedFrame = null; if (_IOleClientSite != null) { Marshal.ReleaseComObject(_IOleClientSite); _IOleClientSite = null; } if (_IOleInPlaceSite != null) { Marshal.ReleaseComObject(_IOleInPlaceSite); _IOleInPlaceSite = null; } } base.Dispose(disposing); }