This commit is contained in:
Paddy Xu
2017-04-30 02:27:07 +03:00
parent f5d9dc3e14
commit f11c59be01
30 changed files with 807 additions and 48 deletions

View File

@@ -23,11 +23,18 @@ namespace QuickLook.Plugin.PDFViewer
public void Dispose()
{
GC.SuppressFinalize(this);
LibMuPdf.NativeMethods.CloseDocument(_doc);
LibMuPdf.NativeMethods.CloseStream(_stm);
LibMuPdf.NativeMethods.FreeContext(_ctx);
}
~PdfFile()
{
Dispose();
}
public bool IsLastPage(int pageId)
{
return pageId >= TotalPages;

View File

@@ -55,13 +55,20 @@ namespace QuickLook.Plugin.PDFViewer
public void Dispose()
{
_whellMonitor.Dispose();
GC.SuppressFinalize(this);
_whellMonitor?.Dispose();
PdfHandleForThumbnails?.Dispose();
PdfHandle?.Dispose();
}
public event PropertyChangedEventHandler PropertyChanged;
~PdfViewerControl()
{
Dispose();
}
public event EventHandler CurrentPageChanged;
private void NavigatePage(object sender, MouseWheelEventArgs e)

View File

@@ -1,4 +1,5 @@
using System.IO;
using System;
using System.IO;
using System.Text;
namespace QuickLook.Plugin.PDFViewer
@@ -45,10 +46,17 @@ namespace QuickLook.Plugin.PDFViewer
};
}
public void Close()
public void Dispose()
{
_pdfControl.Dispose();
GC.SuppressFinalize(this);
_pdfControl?.Dispose();
_pdfControl = null;
}
~Plugin()
{
Dispose();
}
}
}