From db95671a65b81b49ebda2dbce3228ce1eca31b42 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Tue, 28 Mar 2023 19:04:49 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20Windows=20=E7=AB=AF=E9=83=A8=E5=88=86?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E4=B8=8A=E5=86=85=E6=A0=B8=E5=B4=A9=E6=BA=83?= =?UTF-8?q?=20https://github.com/siyuan-note/siyuan/issues/7806?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/util/runtime.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel/util/runtime.go b/kernel/util/runtime.go index 7871b4752..31c605435 100644 --- a/kernel/util/runtime.go +++ b/kernel/util/runtime.go @@ -315,7 +315,12 @@ func existAvailabilityStatus(workspaceAbsPath string) bool { logging.LogInfof("check workspace [%s] availability status", checkAbsPath) - ole.CoInitializeEx(0, ole.COINIT_MULTITHREADED) + runtime.LockOSThread() + defer runtime.LockOSThread() + if err := ole.CoInitializeEx(0, ole.COINIT_MULTITHREADED); nil != err { + logging.LogWarnf("initialize ole failed: %s", err) + return false + } defer ole.CoUninitialize() dir, file := filepath.Split(checkAbsPath) unknown, err := oleutil.CreateObject("Shell.Application")