From 8238da223adc3c0829ed6d2cf8f83a8cbab72d3c Mon Sep 17 00:00:00 2001 From: Paddy Xu Date: Wed, 24 May 2017 00:18:15 +0300 Subject: [PATCH] Fix a error msg upon closing Excel preview window --- .../PreviewPanel.xaml.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/QuickLook.Plugin/QuickLook.Plugin.IPreviewHandlers/PreviewPanel.xaml.cs b/QuickLook.Plugin/QuickLook.Plugin.IPreviewHandlers/PreviewPanel.xaml.cs index 4c5611d..48fbdc2 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.IPreviewHandlers/PreviewPanel.xaml.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.IPreviewHandlers/PreviewPanel.xaml.cs @@ -20,11 +20,14 @@ namespace QuickLook.Plugin.IPreviewHandlers public void Dispose() { - presenter.Child = null; - presenter?.Dispose(); + Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() => + { + presenter.Child = null; + presenter?.Dispose(); - _control?.Dispose(); - _control = null; + _control?.Dispose(); + _control = null; + })); } public void PreviewFile(string file, ContextObject context)