@@ -28,7 +28,7 @@ private sealed unsafe class OleInterfaces :
28
28
IDisposable ,
29
29
IManagedWrapper < IDispatch , IDispatchEx , IOleControlSite , IOleClientSite , IOleWindow , IOleInPlaceSite , ISimpleFrameSite , IVBGetControl , IGetVBAObject , IPropertyNotifySink >
30
30
{
31
- private readonly AxHost _host ;
31
+ private AxHost _host ;
32
32
private ConnectionPointCookie ? _connectionPoint ;
33
33
34
34
internal OleInterfaces ( AxHost host ) => _host = host . OrThrowIfNull ( ) ;
@@ -41,6 +41,9 @@ protected override void Dispose(bool disposing)
41
41
{
42
42
StopEvents ( ) ;
43
43
}
44
+
45
+ // If we don't null this out, this will indirectly root the container control.
46
+ _host = null ! ;
44
47
}
45
48
46
49
internal AxHost GetAxHost ( ) => _host ;
@@ -251,7 +254,7 @@ HRESULT IOleControlSite.Interface.ShowPropertyFrame()
251
254
// IOleClientSite methods:
252
255
HRESULT IOleClientSite . Interface . SaveObject ( ) => HRESULT . E_NOTIMPL ;
253
256
254
- unsafe HRESULT IOleClientSite . Interface . GetMoniker ( uint dwAssign , uint dwWhichMoniker , IMoniker * * ppmk )
257
+ HRESULT IOleClientSite . Interface . GetMoniker ( uint dwAssign , uint dwWhichMoniker , IMoniker * * ppmk )
255
258
{
256
259
if ( ppmk is null )
257
260
{
@@ -262,7 +265,7 @@ unsafe HRESULT IOleClientSite.Interface.GetMoniker(uint dwAssign, uint dwWhichMo
262
265
return HRESULT . E_NOTIMPL ;
263
266
}
264
267
265
- unsafe HRESULT IOleClientSite . Interface . GetContainer ( IOleContainer * * ppContainer )
268
+ HRESULT IOleClientSite . Interface . GetContainer ( IOleContainer * * ppContainer )
266
269
{
267
270
if ( ppContainer is null )
268
271
{
@@ -273,7 +276,7 @@ unsafe HRESULT IOleClientSite.Interface.GetContainer(IOleContainer** ppContainer
273
276
return HRESULT . S_OK ;
274
277
}
275
278
276
- unsafe HRESULT IOleClientSite . Interface . ShowObject ( )
279
+ HRESULT IOleClientSite . Interface . ShowObject ( )
277
280
{
278
281
if ( _host . GetAxState ( s_fOwnWindow ) )
279
282
{
0 commit comments