From f0990faa56b05f62335a3759b817deabd65efab6 Mon Sep 17 00:00:00 2001 From: Paddy Xu Date: Thu, 21 Dec 2017 18:54:24 +0200 Subject: [PATCH] Revert "Async call sometimes crash because NullReferenceException at b__0()" This reverts commit b0e4f19491074ed4a81cd3a600f4ca9a59b797f0. --- QuickLook/ViewerWindow.Actions.cs | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/QuickLook/ViewerWindow.Actions.cs b/QuickLook/ViewerWindow.Actions.cs index b8ddb71..d6e8ded 100644 --- a/QuickLook/ViewerWindow.Actions.cs +++ b/QuickLook/ViewerWindow.Actions.cs @@ -192,15 +192,19 @@ namespace QuickLook ShowWindowCaptionContainer(null, null); //WindowHelper.SetActivate(new WindowInteropHelper(this), ContextObject.CanFocus); - // load plugin, sync - try - { - Plugin.View(path, ContextObject); - } - catch (Exception e) - { - exceptionHandler(path, ExceptionDispatchInfo.Capture(e)); - } + // load plugin, do not block UI + Dispatcher.BeginInvoke(new Action(() => + { + try + { + Plugin.View(path, ContextObject); + } + catch (Exception e) + { + exceptionHandler(path, ExceptionDispatchInfo.Capture(e)); + } + }), + DispatcherPriority.Input); } private void SetOpenWithButtonAndPath()