Exemplo n.º 1
0
 void Dispose(bool disposing)
 {
     if (disposed)
     {
         return;
     }
     disposed = true;
     init     = false;
     if (disposing)
     {
         previewHandler.Unload();
         comSite.Dispose();
         site = null;
         Marshal.ReleaseComObject(previewHandler);
     }
     else
     {
         // We're in the finalizer.
         // Field previewHandler might have been finalized at this point.
         // Get a new RCW.
         var phObject = Marshal.GetUniqueObjectForIUnknown(pPreviewHandler);
         var ph       = phObject as IPreviewHandler;
         if (ph != null)
         {
             ph.Unload();
         }
         Marshal.ReleaseComObject(phObject);
     }
     Marshal.Release(pPreviewHandler);
 }
Exemplo n.º 2
0
 public PreviewHandler(Guid clsid, IPreviewHandlerManagedFrame frame)
 {
     disposed = true;
     init     = false;
     shown    = false;
     comSite  = new PreviewHandlerFrame(frame);
     site     = frame;
     try
     {
         SetupHandler(clsid);
         disposed = false;
     }
     catch
     {
         if (previewHandler != null)
         {
             Marshal.ReleaseComObject(previewHandler);
         }
         previewHandler = null;
         if (pPreviewHandler != IntPtr.Zero)
         {
             Marshal.Release(pPreviewHandler);
         }
         pPreviewHandler = IntPtr.Zero;
         comSite.Dispose();
         comSite = null;
         site    = null;
         throw;
     }
 }
Exemplo n.º 3
0
 public PreviewHandlerFrame(IPreviewHandlerManagedFrame frame)
 {
     disposed = true;
     if (frame == null)
     {
         throw new ArgumentNullException("frame");
     }
     disposed = false;
     site     = frame;
 }
Exemplo n.º 4
0
 public void Dispose()
 {
     disposed = true;
     site     = null;
 }