Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        public int /* IOleInPlaceSite:: */ GetWindowContext([Out] out IntPtr /* IOleInPlaceFrame */ ppFrame, [Out] out IntPtr /* IOleInPlaceUIWindow */ ppDoc, [Out] out IntPtr /* COMRECT */ lprcPosRect, [Out] out IntPtr /* COMRECT */ lprcClipRect, [In] IntPtr /* tagOIFI */ lpFrameInfo)
        {
            _logger.Log(LogLevel.Trace, "IOleInPlaceSite::GetWindowContext() called");
            int hr = _IOleInPlaceSite.GetWindowContext(out ppFrame, out ppDoc, out lprcPosRect, out lprcClipRect, lpFrameInfo);

            if (hr >= 0)
            {
                // call succeeded, so wrap the ppFrame with our own object so that we can control all host owned COM references
                _cachedFrame?.Dispose();
                _cachedFrame = null;
                _cachedFrame = new Wrapper_IOleInPlaceFrame(ppFrame);
                Marshal.Release(ppFrame);    // the Wrapper_IOleInPlaceFrame took its own reference, so we can release this one.
                ppFrame = _cachedFrame.CopyAggregatedReference();

                Debug.Assert(ppDoc == IntPtr.Zero);  // ppDoc not used by VBE, so no need to wrap it
            }

            return(hr);
        }
Esempio n. 3
0
        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);
        }