From d7edd92204749c0f5a6b7785093f4b6bf6772837 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 29 Oct 2025 13:53:28 +0000 Subject: [PATCH] Fix DOpus crash when QuickLook runs with different privilege level --- QuickLook.Native/QuickLook.Native32/DOpus.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/QuickLook.Native/QuickLook.Native32/DOpus.cpp b/QuickLook.Native/QuickLook.Native32/DOpus.cpp index eb1355e..e004f11 100644 --- a/QuickLook.Native/QuickLook.Native32/DOpus.cpp +++ b/QuickLook.Native/QuickLook.Native32/DOpus.cpp @@ -30,7 +30,7 @@ HWND hMsgWnd; HANDLE hGetResultEvent; -PCHAR pXmlBuffer; +PCHAR pXmlBuffer = nullptr; void DOpus::GetSelected(PWCHAR buffer) { @@ -72,9 +72,12 @@ void DOpus::GetSelected(PWCHAR buffer) WaitForSingleObject(hGetResultEvent, 2000); - ParseXmlBuffer(buffer); - - delete[] pXmlBuffer; + if (pXmlBuffer != nullptr) + { + ParseXmlBuffer(buffer); + delete[] pXmlBuffer; + pXmlBuffer = nullptr; + } } void DOpus::ParseXmlBuffer(PWCHAR buffer) @@ -88,6 +91,9 @@ void DOpus::ParseXmlBuffer(PWCHAR buffer) * ... */ + if (pXmlBuffer == nullptr) + return; + using namespace rapidxml; xml_document<> doc;